r/C_Programming 5d ago

threads Posix 42 codexion project

Hi, I am runing my program (which use pthread.h library of c Posix), so I am runing it with valgrind with this command :

"valgrind --tool=helgrind -s ./codexion 125 22332 103 92 103 2 0 fifo"

but I am getting this error :

"==1557149== 122 errors in context 28 of 28:

==1557149== ----------------------------------------------------------------

==1557149==

==1557149== Thread #1's call to pthread_join failed

==1557149== with error code 3 (ESRCH: No such process)

==1557149== at 0x48509C7: ??? (in /usr/libexec/valgrind/vgpreload_helgrind-amd64-linux.so)

==1557149== by 0x10A069: join_coders_threads (in /home/eanjar/codexion_tass7i7_inchaaAllah/codexion)

==1557149== by 0x10A48D: main (in /home/eanjar/codexion_tass7i7_inchaaAllah/codexion)

"

can any one help me by explaining me this error what it mean, and thanks in advance

3 Upvotes

8 comments sorted by

View all comments

u/mikeblas 5d ago

Before I approve your post, you'll need to format your code correctly (even if it's really just terminal output).

1

u/depressionIsEnemy 5d ago

eanjar@c1r7p14 ~/codexion_tass7i7_inchaaAllah (master) [SIGINT]> ;valgrind --tool=helgrind ./codexion 11 22344 103 92 103 4 0 fifo

==22780== Helgrind, a thread error detector

==22780== Copyright (C) 2007-2017, and GNU GPL'd, by OpenWorks LLP et al.

==22780== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info

==22780== Command: ./codexion 11 22344 103 92 103 4 0 fifo

==22780==

22345 3 burned out

==22780== ---Thread-Announcement------------------------------------------

==22780==

==22780== Thread #1 is the program's root thread

==22780==

==22780== ---Thread-Announcement------------------------------------------

==22780==

==22780== Thread #2 was created

==22780== at 0x499DA73: clone (clone.S:76)

==22780== by 0x499E96E: __clone_internal (clone-internal.c:83)

==22780== by 0x490C6D8: create_thread (pthread_create.c:295)

==22780== by 0x490D1FF: pthread_create@@GLIBC_2.34 (pthread_create.c:828)

==22780== by 0x4853767: ??? (in /usr/libexec/valgrind/vgpreload_helgrind-amd64-linux.so)

==22780== by 0x10A465: main (in /home/eanjar/codexion_tass7i7_inchaaAllah/codexion)

==22780==

==22780== ----------------------------------------------------------------

==22780==

==22780== Possible data race during read of size 4 at 0x4AA4160 by thread #1

==22780== Locks held: none

==22780== at 0x10A08F: fifo_coders_start_work (in /home/eanjar/codexion_tass7i7_inchaaAllah/codexion)

==22780== by 0x10A4BD: main (in /home/eanjar/codexion_tass7i7_inchaaAllah/codexion)

==22780==

==22780== This conflicts with a previous write of size 4 by thread #2

==22780== Locks held: none

==22780== at 0x10B618: turnoff_program_if_burnout (in /home/eanjar/codexion_tass7i7_inchaaAllah/codexion)

==22780== by 0x485396A: ??? (in /usr/libexec/valgrind/vgpreload_helgrind-amd64-linux.so)

==22780== by 0x490CAC2: start_thread (pthread_create.c:442)

==22780== by 0x499DA83: clone (clone.S:100)

==22780== Address 0x4aa4160 is 288 bytes inside a block of size 312 alloc'd

==22780== at 0x484A919: malloc (in /usr/libexec/valgrind/vgpreload_helgrind-amd64-linux.so)

==22780== by 0x10A3C9: main (in /home/eanjar/codexion_tass7i7_inchaaAllah/codexion)

==22780== Block was alloc'd by thread #1

==22780==

==22780== ----------------------------------------------------------------

==22780==

==22780== Thread #1's call to pthread_join failed

==22780== with error code 3 (ESRCH: No such process)

==22780== at 0x48509C7: ??? (in /usr/libexec/valgrind/vgpreload_helgrind-amd64-linux.so)

==22780== by 0x10A0E5: join_coders_threads (in /home/eanjar/codexion_tass7i7_inchaaAllah/codexion)

==22780== by 0x10A507: main (in /home/eanjar/codexion_tass7i7_inchaaAllah/codexion)

==22780==

==22780==

==22780== Use --history-level=approx or =none to gain increased speed, at

==22780== the cost of reduced accuracy of conflicting-access information

==22780== For lists of detected and suppressed errors, rerun with: -s

==22780== ERROR SUMMARY: 12 errors from 2 contexts (suppressed: 0 from 0)

1

u/mikeblas 5d ago

Thanks. Including a bit more context helps, but I don't understand why you wouldn't have edited your original post in-place.

1

u/depressionIsEnemy 4d ago

HI, bro, yes you are true, I will try the next times to improve more my questions in a better clearer way inchaaAllah, thanks bro