Skip to content

logging thread_local error when thread exit [Bug]  #248

@haolujun

Description

@haolujun

Search before asking

  • I searched in the issues and found nothing similar.

Version

all version. because I saw that threadSpecificLogPtr in all version code.

Minimal reproduce step

May be use a static client.

What did you expect to see?

Do not have crash!

What did you see instead?

when thread exit and client destory, I called client.close() to close the connection. But, got a crash!. I saw the code and added some debug printf, finally I found that, threadSpecificLogPtr in ./lib/LogUtils.h is destoryed before client close, but thread_local ptr is not null. And then client close and may be use threadSpecificLogPtr to log, and at this time got a pointer that has been destroyed. The destroyed order of client and threadSpecificLogPtr is not correct. Hope the solution!

Anything else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions