'read' race condition without 'write'

Hi there!

I am running a program with two threads under Valgrind tool 'helgrind', and the tool is reporting a race condition. The weird thing about it is that it is only a 'read' race condition, without any write. This is the output error shown by helgrind:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

==3688== Possible data race during read of size 1 at 0x140DE520 by thread #1
==3688== Locks held: 1, at address 0x68DED20
==3688==    at 0x4C370A4: strlen (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
==3688==    by 0xDA39B9F: __tzstring (tzset.c:129)
==3688==    by 0xDA3C025: __tzfile_compute (tzfile.c:767)
==3688==    by 0xDA3AD7E: __tz_convert (tzset.c:624)
==3688==    by 0xDA38BE5: ranged_convert (mktime.c:310)
==3688==    by 0xDA38BE5: __mktime_internal (mktime.c:478)
==3688==    by 0x608EE6D: soap_timegm (stdsoap2.cpp:16363)
==3688==    by 0x608F69F: soap_s2dateTime (stdsoap2.cpp:16604)
==3688==    by 0x608F839: soap_indateTime (stdsoap2.cpp:16635)
==3688==    by 0x5E1F1F6: soap20::soap_in_dateTime(soap*, char const*, long*, char const*) (soap20C.cpp:22999)
==3688==    by 0x5F55546: soap20::soap_in_lfpws2ns__dateTime(soap*, char const*, soap20::lfpws2ns__dateTime*, char const*) (soap20C.cpp:112509)
==3688==    by 0x5F55377: soap20::lfpws2ns__dateTime::soap_in(soap*, char const*, char const*) (soap20C.cpp:112489)
==3688==    by 0x5FD038A: soap20::soap_in_PointerTolfpws2ns__dateTime(soap*, char const*, soap20::lfpws2ns__dateTime**, char const*) (soap20C.cpp:143643)
==3688==  Address 0x140de520 is 1,680 bytes inside a block of size 1,715 alloc'd
==3688==    at 0x4C2EFAF: malloc (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
==3688==    by 0xDA3B41B: __tzfile_read (tzfile.c:282)
==3688==    by 0xDA3AD1D: tzset_internal (tzset.c:441)
==3688==    by 0xDA3AD1D: __tz_convert (tzset.c:621)
==3688==    by 0x59DFA27: evutil_date_rfc1123 (evutil_time.c:168)
==3688==    by 0x59C13E3: evhttp_maybe_add_date_header (http.c:493)
==3688==    by 0x59C1563: evhttp_make_header_response (http.c:530)
==3688==    by 0x59C17D1: evhttp_make_header (http.c:606)
==3688==    by 0x59C612C: evhttp_send (http.c:2804)
==3688==    by 0x59C6185: evhttp_send_reply (http.c:2815)
==3688==    by 0x589EA3E: WSSIMULATOR::WebServicesSim::run()::{lambda(evhttp_request*, void*)#1}::operator()(evhttp_request*, void*) const (wssim.cpp:784)
==3688==    by 0x589EB4A: WSSIMULATOR::WebServicesSim::run()::{lambda(evhttp_request*, void*)#1}::_FUN(evhttp_request*, void*) (wssim.cpp:786)
==3688==    by 0x59C7306: evhttp_handle_request (http.c:3444)
==3688==  Block was alloc'd by thread #2


Could someone explain this please? How is this possible?

Thanks a lot!
Is the matching source for __tz_convert?
https://github.com/lattera/glibc/blob/master/time/tzset.c

I could be both threads calling __set_errno.
Topic archived. No new replies allowed.