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

Helgrind: Possible data race in SdlVideo.cc #118

Open
JohnSmithBH84 opened this issue Dec 12, 2024 · 0 comments
Open

Helgrind: Possible data race in SdlVideo.cc #118

JohnSmithBH84 opened this issue Dec 12, 2024 · 0 comments

Comments

@JohnSmithBH84
Copy link

Helgrind detected a data race in SdlVideo.cc:262 after launching doom64ex. I'm not sure whether this is an actual issue, or whether Doom64EX' code is too sophisticated for Helgrind to understand. Do you guys have any idea?

Project version

Doom64EX: (master a5a8ccb)
clang: 19.1.0 (x86_64-unknown-linux-gnu)

Operating system

Ubuntu 22.04.4 LTS
Linux 5.15.0-125-generic #135-Ubuntu SMP Fri Sep 27 13:53:58 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

I did this

Configured and build the project.

mkdir build & cd build
cmake -DCMAKE_BUILD_TYPE=DEBUG -Wno-dev ..
cmake --build . -- -j16

Launched executable without arguments.
valgrind --tool=helgrind ./Doom64EX/build/doom64ex

I expected the following

No data race reported by Helgrind

I got the following

= ----------------------------------------------------------------
==3303== 
==3303==  Lock at 0x974CAE0 was first observed
==3303==    at 0x80D2EA9: pthread_mutex_init (hg_intercepts.c:818)
==3303==    by 0x822B2B1: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.2600.5)
==3303==    by 0x814E374: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.2600.5)
==3303==    by 0x811A29B: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.2600.5)
==3303==    by 0x23ABF8: SdlVideo::SdlVideo(imp::OpenGLVer) (SdlVideo.cc:262)
==3303==    by 0x239D0A: init_video_sdl() (SdlVideo.cc:546)
==3303==    by 0x2395C1: I_InitScreen() (i_video.cc:49)
==3303==    by 0x239662: I_InitVideo() (i_video.cc:113)
==3303==    by 0x2391C3: I_Init() (i_system.cc:278)
==3303==    by 0x1B6C87: D_DoomMain() (d_main.cc:994)
==3303==    by 0x19302E: imp::app::main(int, char**) (App.cc:144)
==3303==    by 0x193615: main (App.cc:219)
==3303==  Address 0x974cae0 is 0 bytes inside a block of size 40 alloc'd
==3303==    at 0x80CD62F: calloc (vg_replace_malloc.c:1328)
==3303==    by 0x8187860: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.2600.5)
==3303==    by 0x822B284: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.2600.5)
==3303==    by 0x814E374: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.2600.5)
==3303==    by 0x811A29B: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.2600.5)
==3303==    by 0x23ABF8: SdlVideo::SdlVideo(imp::OpenGLVer) (SdlVideo.cc:262)
==3303==    by 0x239D0A: init_video_sdl() (SdlVideo.cc:546)
==3303==    by 0x2395C1: I_InitScreen() (i_video.cc:49)
==3303==    by 0x239662: I_InitVideo() (i_video.cc:113)
==3303==    by 0x2391C3: I_Init() (i_system.cc:278)
==3303==    by 0x1B6C87: D_DoomMain() (d_main.cc:994)
==3303==    by 0x19302E: imp::app::main(int, char**) (App.cc:144)
==3303==  Block was alloc'd by thread #1
==3303== 
==3303== Possible data race during write of size 8 at 0x82BA588 by thread #1
==3303== Locks held: 1, at address 0x974CAE0
==3303==    at 0x811BE9E: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.2600.5)
==3303==    by 0x814A53B: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.2600.5)
==3303==    by 0x814E31F: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.2600.5)
==3303==    by 0x811A29B: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.2600.5)
==3303==    by 0x23ABF8: SdlVideo::SdlVideo(imp::OpenGLVer) (SdlVideo.cc:262)
==3303==    by 0x239D0A: init_video_sdl() (SdlVideo.cc:546)
==3303==    by 0x2395C1: I_InitScreen() (i_video.cc:49)
==3303==    by 0x239662: I_InitVideo() (i_video.cc:113)
==3303==    by 0x2391C3: I_Init() (i_system.cc:278)
==3303==    by 0x1B6C87: D_DoomMain() (d_main.cc:994)
==3303==    by 0x19302E: imp::app::main(int, char**) (App.cc:144)
==3303==    by 0x193615: main (App.cc:219)
==3303== 
==3303== This conflicts with a previous read of size 8 by thread #3
==3303== Locks held: none
==3303==    at 0x811BBEC: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.2600.5)
==3303==    by 0x822AD8F: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.2600.5)
==3303==    by 0x81E7213: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.2600.5)
==3303==    by 0x8189084: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.2600.5)
==3303==    by 0x822AB78: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.2600.5)
==3303==    by 0x80D17D6: mythread_wrapper (hg_intercepts.c:406)
==3303==    by 0x86C01C3: start_thread (pthread_create.c:442)
==3303==    by 0x873FABF: clone (clone.S:100)
==3303==  Address 0x82ba588 is in the BSS segment of /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.2600.5
==3303== 
==3303== ----------------------------------------------------------------
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

1 participant