Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thread.start() will create a new trace #8082

Closed
soulmate1314 opened this issue Mar 18, 2023 · 1 comment
Closed

Thread.start() will create a new trace #8082

soulmate1314 opened this issue Mar 18, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@soulmate1314
Copy link

soulmate1314 commented Mar 18, 2023

###environment Description
instrument version:1.4.1
###Bug Description
when use Thread.start() ,the OkHttpUtil.httpGet('url') span will be a new trace ,not in the old trace.
###Bug recurrence process

private ExecutorService executorService = new ThreadPoolExecutor(2, 5,
        0L, TimeUnit.MILLISECONDS,
        new LinkedBlockingQueue<Runnable>(1024), new ThreadFactoryBuilder()
        .setNameFormat("yansir-pool-%d").build(), new ThreadPoolExecutor.AbortPolicy());
    //Thread.start() will create a new trace
    new Thread(new ConsumeRunable(id)).start();

    //Thread.run() will continue the old trace,
    new Thread(new ConsumeRunable(id)).run();
    //ThreadPoolExecutor.execute() will continue the old trace,
    executorService.execute(new ConsumeRunable(id));

private class ConsumeRunable implements Runnable{
    private int id;
    public ConsumeRunable(int id) {
        this.id = id;
    }
    @Override
    public void run() {
        OkHttpUtil.httpGet("http://127.0.0.1:9003/b/breceive?id="+id);
    }
}
@soulmate1314 soulmate1314 added the bug Something isn't working label Mar 18, 2023
@laurit
Copy link
Contributor

laurit commented Mar 22, 2023

Duplicate of #2527
Propagating context into threads started with Thread.start() is not implemented yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants