Home > pthread mutex lock mutex > pthread_mutex_lock &mutex failed with error 22

Pthread_mutex_lock &mutex Failed With Error 22

from GoogleSign inHidden fieldsSearch for groups or messages

here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign https://groups.google.com/d/msg/googlemock/o0spo6ZR08A/mextOolSy0oJ up pthread-related errors when upgrading test from GoogleTest to GoogleMock (Ubuntu 14) up vote 1 down vote favorite While trying to add gmock to an existing project that already was using gtest, I have found a series of low-level errors related to pthread. My guess is this is related to how GoogleMock & GoogleTest are built (see details below), but unfortunately there http://stackoverflow.com/questions/30865653/pthread-related-errors-when-upgrading-test-from-googletest-to-googlemock-ubuntu is not much information about the best way of using these libraries in Ubuntu 14. After reducing the code to a minimal representative example, what happens is: I replaced the GoogleTest headers with the GoogleMock ones, as well as the "main" function: // Declarations at foo.h class Foo { public: int sum(int a, int b); // it returns a+b (defined in foo.cpp) }; // Test code at foo.test.cpp #include // replaced #include "foo.h" TEST(Foo,ReturnsSumOfTwoNumbers){ Foo foo; ASSERT_EQ( foo.sum(2,8), 10 ); } TEST(Foo,ReturnsSumOfTwoIntegerNumbers){ Foo foo; ASSERT_EQ( 6,foo.sum(-2,8) ); } // main.cpp #include // replaced int main(int argc, char **argv) { ::testing::InitGoogleMock(&argc, argv); // replaced InitGoogleTest return RUN_ALL_TESTS(); } This works FINE. When I try to use a GoogleMock feature (e.g a matcher): // foo.test.cpp using ::testing::Eq; //... TEST(Foo,ReturnsSumOfTwoNumbers){ Foo foo; // replaced ASSERT_EQ ASSERT_THAT( foo.sum(2,8), Eq(10) ); } .. It crashes with the following error: [ FATAL ] /path/to/gmock-1.7.0/gtest/include/gtest/internal/gtest-port.h:1340:: pthread_mutex_lock(&mutex_)failed with error 22 Aborted (core dumped) Using other gmock features yielded similar errors. Build info: Ubuntu 14.04 gcc 4.8.2 gmock 1.7.0 is downloaded and built with CMAKE: wget https://googlemock.googlecode.com/files/gmock-1.7.0.zip unzip gmock-1.7.0.zip GMOCK_PATH=$PWD/gmock-1.7.0 GTEST_PATH=$GMOCK_PATH/gte

Forum Visual C++ & C++ Programming C++ (Non Visual C++ Issues) pthread_mutex_lock fails If this is your first visit, be sure to check out the FAQ http://forums.codeguru.com/showthread.php?508898-pthread_mutex_lock-fails by clicking the link above. You may have to register or Login before https://bugs.chromium.org/p/chromium/issues/detail?id=211445 you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. Results 1 to 6 of 6 Thread: pthread_mutex_lock fails Tweet Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Display Linear Mode Switch pthread_mutex_lock &mutex to Hybrid Mode Switch to Threaded Mode February 18th, 2011,12:40 AM #1 srinivasant View Profile View Forum Posts Junior Member Join Date Jul 2007 Posts 15 pthread_mutex_lock fails Hi, I have linked statically libodbc++ (libodbc++-mt.a) with my CPP application and connect to MySQL from various threads simultaneously from my application. At some point my application crashes with the following error, terminate called after throwing an instance pthread_mutex_lock &mutex failed of 'odbc::SQLException' what(): [libodbc++]: OS error, mutex lock failed HY000 : [libodbc++]: OS error, mutex lock failed :: [Open DB] : IN DB /home/test/Users/Srini/xxxxxxx/dbnamexxx terminate called recursively HY000 : [libodbc++]: OS error, mutex lock failed :: [Open DB] : IN DB /home/test/Users/Srini/xxxxxxx/dbnamexxx terminate called recursively HY000 : [libodbc++]: OS error, mutex lock failed :: [Open DB] : IN DB /home/test/Users/Srini/xxxxxxx/dbnamexxx Aborted Seems the pthread_mutex_lock() in src/threads.cpp fails with error and libodbc throws exception and hence application crashes (running in my application in debug mode). I have checked the return value of pthread_mutex_lock() and it is EINVAL (22) which means Invalid Argument. The details of my setup is as follows, OS : Cent OS 5.3 libodbc++ : v0.2.3 unixODBC : v2.2.15pre MySQL Driver : v3.51.27 MySQL Server : v5.1.39 My odbcinst.ini file is as follows, -------------------8<---------------------- [ODBC] Trace = No Trace File = /tmp/sql.log Pooling = Yes [MySQL] Description = Driver = /usr/local/lib/libmyodbc3-3.51.27.so Driver64 = Setup = /usr/local/lib/libmyodbc3S-3.51.27.so Setup64 = UsageCount =1 CPTimeout =300 CPReuse =1 Threading =0 ------------------->8---------------------- My configure option for libodbc++ is as follows, ./configure --enable-static=yes --with-odbc=/home/path/to/unixodbc/unixODBC-2.2.15pre/DriverManager/.libs/ --enable-threads=yes I have also tested with libodbc++ v0.2.5 and still I face the same issue.

by 3 users Reported by rochberg@chromium.org, Apr 2 2012 Back to list Status: Verified Owner: gauravsh@chromium.org Closed: Apr 2013 Cc: josephsih@chromium.org, dkrahn@chromium.org, dgarr...@chromium.org, vapier@chromium.org, garnold@chromium.org NextAction: ---- OS: Chrome Pri: 2 Type: Feature Iteration-80 M-28 Iteration-78 PendingDevFeedback Iteration-79 Blocking: issue chromium-os:32014 Sign in to add a comment Gmock v1.6 promises better compile times. It takes the build time of shill/wifi_unittest.cc from a spectacular 46s to a merely-unacceptable 16s. Unfortunately, the resulting binary dumps core during initialization [ FATAL ] /build/x86-alex/usr/include/gtest/internal/gtest-port.h:1208:: pthread_mutex_lock(&mutex_)failed with error 22 Program received signal SIGABRT, Aborted. 0x00007ffff62b0e65 in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 64 ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory. in ../nptl/sysdeps/unix/sysv/linux/raise.c (gdb) where #0 0x00007ffff62b0e65 in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 #1 0x00007ffff62b22c7 in abort () at abort.c:92 #2 0x00007ffff6da1d12 in testing::internal::GTestLog::~GTestLog() () from /build/x86-alex/usr/lib64/libgtest.so.0 #3 0x00007ffff779296e in Lock (this=0x7ffff807a6d8, ptr=0x7fffffffd788) at /build/x86-alex/usr/include/gtest/internal/gtest-port.h:1208 #4 GTestMutexLock (this=0x7ffff807a6d8, ptr=0x7fffffffd788) at /build/x86-alex/usr/include/gtest/internal/gtest-port.h:1268 #5 testing::internal::linked_ptr_internal::join (this=0x7ffff807a6d8, ptr=0x7fffffffd788) at /build/x86-alex/usr/include/gtest/internal/gtest-linked_ptr.h:110 #6 0x00007ffff7c5bc71 in copy::TestInfo> (this=0x7ffff807a5e0, __position=..., __x=...) at /build/x86-alex/usr/include/gtest/internal/gtest-linked_ptr.h:206 #7 copy::TestInfo> (this=0x7ffff807a5e0, __position=..., __x=...) at wifi_unittest.cc:1746 #8

 

Related content

pthread_mutex_lock &mutex failed with error

Pthread mutex lock mutex Failed With Error table id toc tbody tr td div id toctitle Contents div ul li a href Pthread mutex init a li ul td tr tbody table p from GoogleSign inHidden fieldsSearch for groups or messages p p Forum Visual C C Programming C Non Visual C Issues pthread mutex lock fails If this relatedl is your first visit be sure to check out the FAQ by clicking the link above You may have to register or Login before you can post click the register link above to proceed To start viewing messages select the