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

Possible thread deadlock in eassylogging #244

Closed
ial0 opened this issue Nov 3, 2016 · 3 comments
Closed

Possible thread deadlock in eassylogging #244

ial0 opened this issue Nov 3, 2016 · 3 comments

Comments

@ial0
Copy link
Contributor

ial0 commented Nov 3, 2016

While looking into issue #214 I ran clang's thread sanitizer, this found a potential deadlock within easylogging++. I'm not sure if this has any bearing on #214 or not could it could be part of the issue.

==================
WARNING: ThreadSanitizer: lock-order-inversion (potential deadlock) (pid=3933)
  Cycle in lock order graph: M11 (0x7d480000be90) => M13 (0x7d4400009d90) => M17 (0x7d580000fc10) => M11

  Mutex M13 acquired here while holding mutex M11 in main thread:
    #0 pthread_mutex_lock <null> (encfs+0x0000004e1285)
    #1 el::base::threading::internal::Mutex::lock() /home/ial/Devel/Encfs/encfs/internal/easylogging++.h:996:45 (encfs+0x0000005680ec)
    #2 el::base::threading::internal::ScopedLock<el::base::threading::internal::Mutex>::ScopedLock(el::base::threading::internal::Mutex&) /home/ial/Devel/Encfs/encfs/internal/easylogging++.h:1031:54 (encfs+0x000000567f09)
    #3 el::base::RegisteredLoggers::get(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) /home/ial/Devel/Encfs/encfs/internal/easylogging++.h:3673:45 (encfs+0x00000056b26c)
    #4 el::Loggers::getLogger(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) /home/ial/Devel/Encfs/encfs/internal/easylogging++.h:5825:47 (encfs+0x0000005e01e5)
    #5 el::Loggers::reconfigureLogger(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, el::Configurations const&) /home/ial/Devel/Encfs/encfs/internal/easylogging++.h:5846:47 (encfs+0x0000005e0069)
    #6 encfs::initLogging(bool) /home/ial/Devel/Encfs/encfs/encfs/Error.cpp:20:3 (encfs+0x0000005df77e)
    #7 main /home/ial/Devel/Encfs/encfs/encfs/main.cpp:546:3 (encfs+0x00000055a7fe)

    Hint: use TSAN_OPTIONS=second_deadlock_stack=1 to get more informative warning message

  Mutex M17 acquired here while holding mutex M13 in main thread:
    #0 pthread_mutex_lock <null> (encfs+0x0000004e1285)
    #1 el::base::threading::internal::Mutex::lock() /home/ial/Devel/Encfs/encfs/internal/easylogging++.h:996:45 (encfs+0x0000005680ec)
    #2 el::base::threading::internal::ScopedLock<el::base::threading::internal::Mutex>::ScopedLock(el::base::threading::internal::Mutex&) /home/ial/Devel/Encfs/encfs/internal/easylogging++.h:1031:54 (encfs+0x000000567f09)
    #3 el::Logger::configure(el::Configurations const&) /home/ial/Devel/Encfs/encfs/internal/easylogging++.h:3486:41 (encfs+0x000000584158)
    #4 el::Logger::Logger(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, el::Configurations const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<std::basic_fstream<char, std::char_traits<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<std::basic_fstream<char, std::char_traits<char> > > > > >*) /home/ial/Devel/Encfs/encfs/internal/easylogging++.h:3441:13 (encfs+0x000000583c7c)
    #5 el::base::RegisteredLoggers::get(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) /home/ial/Devel/Encfs/encfs/internal/easylogging++.h:3681:35 (encfs+0x00000056b52b)
    #6 el::base::Storage::Storage(std::shared_ptr<el::LogBuilder> const&) /home/ial/Devel/Encfs/encfs/internal/easylogging++.h:3972:38 (encfs+0x00000056252c)
    #7 __cxx_global_var_init.4 /home/ial/Devel/Encfs/encfs/encfs/main.cpp:61:1 (encfs+0x0000004c094e)
    #8 _GLOBAL__sub_I_main.cpp /home/ial/Devel/Encfs/encfs/encfs/main.cpp (encfs+0x0000004c0a65)
    #9 __libc_csu_init <null> (encfs+0x000000647e3c)

  Mutex M11 acquired here while holding mutex M17 in main thread:
    #0 pthread_mutex_lock <null> (encfs+0x0000004e1285)
    #1 el::base::threading::internal::Mutex::lock() /home/ial/Devel/Encfs/encfs/internal/easylogging++.h:996:45 (encfs+0x0000005680ec)
    #2 el::base::threading::internal::ScopedLock<el::base::threading::internal::Mutex>::ScopedLock(el::base::threading::internal::Mutex&) /home/ial/Devel/Encfs/encfs/internal/easylogging++.h:1031:54 (encfs+0x000000567f09)
    #3 el::base::LogDispatcher::dispatch() /home/ial/Devel/Encfs/encfs/internal/easylogging++.h:4508:45 (encfs+0x0000005a9871)
    #4 el::base::Writer::triggerDispatch() /home/ial/Devel/Encfs/encfs/internal/easylogging++.h:5090:92 (encfs+0x0000005a8e53)
    #5 el::base::Writer::processDispatch() /home/ial/Devel/Encfs/encfs/internal/easylogging++.h:5073:25 (encfs+0x0000005a8ad0)
    #6 el::base::Writer::~Writer() /home/ial/Devel/Encfs/encfs/internal/easylogging++.h:4959:17 (encfs+0x000000563ad6)
    #7 main /home/ial/Devel/Encfs/encfs/encfs/main.cpp:548:3 (encfs+0x00000055a925)

SUMMARY: ThreadSanitizer: lock-order-inversion (potential deadlock) (/home/ial/Devel/Encfs/encfs/build/encfs+0x4e1285) in __interceptor_pthread_mutex_lock
==================
2016-11-03 14:03:11,389 VER [main.cpp:548] Root directory: /tmp/a/
2016-11-03 14:03:11,389 VER [main.cpp:549] Fuse arguments: (fg) (threaded) (keyCheck) encfs /tmp/b/ -f -o use_ino -o default_permissions 
2016-11-03 14:03:11,396 VER [FileUtils.cpp:294] found new serialization format
2016-11-03 14:03:11,396 VER [FileUtils.cpp:308] subVersion = 20100713
2016-11-03 14:03:11,396 VER [Interface.cpp:110] checking if ssl/aes(3:0:2) implements ssl/aes(3:0)
2016-11-03 14:03:11,397 VER [SSL_Cipher.cpp:333] allocated cipher ssl/aes, keySize 24, ivlength 16
2016-11-03 14:03:11,397 VER [FileUtils.cpp:1580] useStdin: 0
@ial0 ial0 changed the title Possible thread deadlonk in eassylogging Possible thread deadlock in eassylogging Nov 3, 2016
@abumq
Copy link

abumq commented Feb 1, 2017

Please see comment on abumq/easyloggingpp#417

@abumq
Copy link

abumq commented Feb 1, 2017

PLEASE SEE IMPORTANT RELEASE NOTE FOR v9.90+ UPGRADE.

The only change you need is to import easylogging++.cc and add it to your source files list. that's it. This is done to speed up compile time as header only can become slow. See this issue for further details

@benrubson
Copy link
Contributor

#298 merged, issue should be solved 👍

@ial0 ial0 closed this as completed Apr 22, 2017
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

3 participants