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

[CameraServer] destroy VideoListener first #7686

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mcm001
Copy link
Contributor

@mcm001 mcm001 commented Jan 15, 2025

[potentially] fixes #7685

@mcm001 mcm001 requested a review from a team as a code owner January 15, 2025 02:55
@PeterJohnson
Copy link
Member

Have you been able to confirm that this fixes the issue?

@mcm001
Copy link
Contributor Author

mcm001 commented Jan 16, 2025

I haven't yet. @Sam948-byte had that in work

@Sam948-byte
Copy link

I haven't yet. @Sam948-byte had that in work

I wasn't able to get to that last night. I think the earliest I can test is probably tomorrow night.

@auscompgeek
Copy link
Member

A test that reproduces the issue with ASan + TSan would be good.

@mcm001
Copy link
Contributor Author

mcm001 commented Jan 17, 2025

I'm not sure what Photon does that wpilib's ci doesn't that would trigger this bug in the first place. Allwpilib already has tests run under sanitizers.

@auscompgeek
Copy link
Member

I don't see any tests for CameraServer 😅

@mcm001
Copy link
Contributor Author

mcm001 commented Jan 18, 2025

i suppose that would do it, eh? lol. we should upstream some tests, then

@mcm001 mcm001 force-pushed the cameraserver-dtor-ordering branch from d5c6140 to 1846af7 Compare February 13, 2025 05:31
@mcm001
Copy link
Contributor Author

mcm001 commented Feb 13, 2025

I'm sometimes seeing new one this locally, and even with this patch, I'm still seeing use-after-frees. Could we be removing the listener after the callback has been invoked by the callback thread? I don't see any synchronization happen in CallbackManager::Remove at all.

AddressSanitizer:DEADLYSIGNAL
=================================================================
==62371==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f9117f8f382 bp 0x7ffe9a902b20 sp 0x7ffe9a902b10 T0)
==62371==The signal is caused by a READ memory access.
==62371==Hint: address points to the zero page.
    #0 0x7f9117f8f382 in wpi::DenseMapInfo<unsigned int, void>::isEqual(unsigned int const&, unsigned int const&) /home/matt/allwpilib/wpiutil/src/main/native/thirdparty/llvm/include/wpi/DenseMapInfo.h:132
    #1 0x7f9116df16c5 in destroyAll /home/matt/allwpilib/wpiutil/src/main/native/thirdparty/llvm/include/wpi/DenseMap.h:410
    #2 0x7f9116df0ceb in ~DenseMap /home/matt/allwpilib/wpiutil/src/main/native/thirdparty/llvm/include/wpi/DenseMap.h:798
    #3 0x7f9116decc5f in ~HandleManager /home/matt/allwpilib/wpiutil/src/main/native/cpp/Synchronization.cpp:31
    #4 0x7f911449ba75 in __run_exit_handlers stdlib/exit.c:108
    #5 0x7f911449bbbd in __GI_exit stdlib/exit.c:138
    #6 0x7f911447e1d0 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:74
    #7 0x7f911447e28a in __libc_start_main_impl ../csu/libc-start.c:360
    #8 0x55e5e762c5a4 in _start (/home/matt/allwpilib/build-cmake/bin/cameraserver_test+0x55a4) (BuildId: 3cdebe83132b3982899c6c909a559e91072cdd8e)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /home/matt/allwpilib/wpiutil/src/main/native/thirdparty/llvm/include/wpi/DenseMapInfo.h:132 in wpi::DenseMapInfo<unsigned int, void>::isEqual(unsigned int const&, unsigned int const&)
==62371==ABORTING

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

Successfully merging this pull request may close these issues.

[CameraServer] segfault during static destruction
4 participants