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

zlog_fini multi thread dead lock #49

Open
ligzy opened this issue Oct 28, 2013 · 1 comment
Open

zlog_fini multi thread dead lock #49

ligzy opened this issue Oct 28, 2013 · 1 comment

Comments

@ligzy
Copy link

ligzy commented Oct 28, 2013

HI,
Thank your library first.It's very good log library.
I am use for my work.
I use it in a multi thread program.
I found a question that when in function will not exit.

In my main thread ,when i got a signal such as SEGEV then call clean up function. In clean function it will cal zlog_fini(void).
but some time it will hung there and not exit,then the program will not exit.
I use debug message found that 👍 in zlog_fini(void)
rc = pthread_rwlock_wrlock(&zlog_env_lock);
is waiting and not return.because of another thread got the lock somewhere.
if when cleanup i call zlog_fini(void) in that thread it will success and every thing is ok.

So i guess here is a multi thread bug in multi thread call zlog_fini(void).

special thanks for your the good library.

Thanks!

Jeremy Li

@HardySimpson
Copy link
Owner

That would happen.
I think when your main thread receive SEGSEV and call zlog_fini in signal handle function,
another working thread is still in log fuction, which get the read lock.

As zlog_fini() should get the write lock, and wait for all the read lock release.
I don't know how to correctly solve this kind of problem in any multi-thread program.

In this case, I think the useful way is not call zlog_fini() in signal handle function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants