Re: svnserve frequently die at assertion in utf.c

Guido Jäkel <[email protected]> Tue, 7 Jan 2025 08:07:08 +0100
Newsgroups gmane.comp.version-control.subversion.user
Message-ID <[email protected]>
Dear Sean,

I'm no developer, but Google probably tell me to add the right flags:

root@testsub0 /var/tmp/portage/dev-vcs/subversion-1.14.5/work/subversion-1.14.5/testcase # diff Makefile{.20250107-073455,} -u
--- Makefile.20250107-073455	2025-01-07 07:34:55.000000000 +0100
+++ Makefile	2025-01-07 07:59:56.481738320 +0100
@@ -1,5 +1,5 @@
-CFLAGS=-I/usr/include/apr-1.0
-LDFLAGS=-L/usr/lib/x86_64-linux-gnu
+CFLAGS=-I/usr/include/apr-1 -fsanitize=thread
+LDFLAGS=-L/usr/lib/x86_64-linux-gnu -fsanitize=thread
  LDLIBS=-lapr-1
  
  all: main


For the testcase, this catches problems:

root@testsub0 /var/tmp/portage/dev-vcs/subversion-1.14.5/work/subversion-1.14.5/testcase # ./main n |& tail -50

   Thread T3 (tid=58578, running) created by main thread at:
     #0 pthread_create <null> (libtsan.so.2+0x39fe9)
     #1 main <null> (main+0x1cb1)

   Thread T2 (tid=58577, running) created by main thread at:
     #0 pthread_create <null> (libtsan.so.2+0x39fe9)
     #1 main <null> (main+0x1cb1)

SUMMARY: ThreadSanitizer: data race (/var/tmp/portage/dev-vcs/subversion-1.14.5/work/subversion-1.14.5/testcase/main+0x1695) in threadfunc
==================
==================
WARNING: ThreadSanitizer: data race (pid=58573)
   Write of size 8 at 0x7b0400003848 by thread T1:
     #0 threadfunc <null> (main+0x167e)
     #1 <null> <null> (libtsan.so.2+0x34247)

   Previous write of size 8 at 0x7b0400003848 by thread T10:
     #0 threadfunc <null> (main+0x167e)
     #1 <null> <null> (libtsan.so.2+0x34247)

   As if synchronized via sleep:
     #0 usleep <null> (libtsan.so.2+0x5acbd)
     #1 threadfunc <null> (main+0x1794)
     #2 <null> <null> (libtsan.so.2+0x34247)

   Location is heap block of size 16 at 0x7b0400003840 allocated by thread T7:
     #0 malloc <null> (libtsan.so.2+0x39137)
     #1 threadfunc <null> (main+0x1532)
     #2 <null> <null> (libtsan.so.2+0x34247)

   Thread T1 (tid=58576, running) created by main thread at:
     #0 pthread_create <null> (libtsan.so.2+0x39fe9)
     #1 main <null> (main+0x1cb1)

   Thread T10 (tid=58585, running) created by main thread at:
     #0 pthread_create <null> (libtsan.so.2+0x39fe9)
     #1 main <null> (main+0x1cb1)

   Thread T7 (tid=58582, running) created by main thread at:
     #0 pthread_create <null> (libtsan.so.2+0x39fe9)
     #1 main <null> (main+0x1cb1)

SUMMARY: ThreadSanitizer: data race (/var/tmp/portage/dev-vcs/subversion-1.14.5/work/subversion-1.14.5/testcase/main+0x167e) in threadfunc
==================
ThreadSanitizer: reported 4 warnings
Creating mutex and threads... Done
Waiting for threads to finish... Finished
Checking for errors...
Thread 1 missing 0 found 4


Now, I'll try to apply this to the subversion Makefile and run the test suite...

On 07.01.25 05:11, Sean McBride wrote:
> On 6 Jan 2025, at 16:32, Daniel Sahlberg wrote:
> 
>> To me, this proves that my basic program is correct and that with a mutex, the shared memory is protected and without the mutex we get errors. I have tested this under both Ubuntu and Guix with the same results.
> 
> If you really want to prove correctness, build with thread sanitizer; that'll help catch any race conditions.
> 
> Sean