[Bug]: Leaked objects detected in example source
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- cpp
- Domain
- audio-video-rtc
Research direction
Reproduce by building examples/CMakeLists.txt (the Benchmarks target) in Visual Studio 2022 and running it under the debugger; the assertion fires in juce::LeakedObjectDetectorjuce::OggReader::LeakCounter::~LeakCounter at exit. Start by finding where the benchmark code creates or holds a juce::OggReader and whether that reference is released before shutdown, then trace the 'ERROR: Failed to publish!' path in the benchmark runner. Done means the run exits with no leak assertion and the benchmarks publish successfully.
Written by the indexing model from the issue text.
Description
Detailed steps on how to reproduce the bug
I ran examples\CMakeLists.txt with Visual Studio 2022, and it built it and ran a bunch of benchmarks, and then I got a breakpoint with this call stack:
'''
Benchmarks.exe!juce::LeakedObjectDetectorjuce::OggReader::LeakCounter::~LeakCounter() Line 104 C++
[External Code]
Benchmarks.exe!_execute_onexit_table::__l2::() Line 206 C++
Benchmarks.exe!__crt_seh_guarded_call::operator()<void (void),int (void) &,void (void)>(__acrt_lock_and_call::__l2::void (void) && setup, _execute_onexit_table::__l2::int (void) & action, __acrt_lock_and_call::__l2::void (void) && cleanup) Line 204 C++
Benchmarks.exe!__acrt_lock_and_call<int (void)>(const __acrt_lock_id lock_id, _execute_onexit_table::__l2::int (void) && action) Line 974 C++
Benchmarks.exe!_execute_onexit_table(_onexit_table_t * table) Line 231 C++
Benchmarks.exe!common_exit::__l2::() Line 221 C++
Benchmarks.exe!__crt_seh_guarded_call::operator()<void (void),void (void) &,void (void)>(__acrt_lock_and_call::__l2::void (void) && setup, common_exit::__l2::void (void) & action, __acrt_lock_and_call::__l2::void (void) && cleanup) Line 224 C++
Benchmarks.exe!__acrt_lock_and_call<void (void)>(const __acrt_lock_id lock_id, common_exit::__l2::void (void) && action) Line 974 C++
Benchmarks.exe!common_exit(const int return_code, const _crt_exit_cleanup_mode cleanup_mode, const _crt_exit_return_mode return_mode) Line 253 C++
Benchmarks.exe!exit(int return_code) Line 288 C++
[External Code]
'''
The source code at the breakpoint says
'''
if (numObjects.value > 0)
{
DBG ("*** Leaked objects detected: " << numObjects.value << " instance(s) of class " << getLeakedObjectClassName());
/** If you hit this, then you've leaked one or more objects of the type specified by
the 'OwnerClass' template parameter - the name should have been printed by the line above.
If you're leaking, it's probably because you're using old-fashioned, non-RAII techniques for
your object management. Tut, tut. Always, always use std::unique_ptrs, OwnedArrays,
ReferenceCountedObjects, etc, and avoid the 'delete' operator at all costs!
*/
jassertfalse;
}
'''
The console has a lot of benchmark statements ending with
'''
LightweightSemaphore signal, Threads
Signal 10 (may not be waiting)
[seconds] 0.0350477 (min: 0, max: 4e-05, mean: 3.50477e-07, var: 1.42449e-13)
[cycles] 96088874 (min: 232, max: 105208, mean: 960, var: 1.11709e+06)
ERROR: Failed to publish!
'''
What is the expected behaviour?
I expected it not to call the breakpoint and to successfully publish the benchmarks (whatever that means).
Unit test to reproduce the error?
/*
Copy this code in to your application, replacing the test cases in the runTest function.
Then call runTest() from somewhere in your application.
*/
class TestClassName : public juce::UnitTest
{
public:
TestClassName()
: juce::UnitTest ("TestClass", "tracktion_engine")
{
}
void runTest() override
{
// Group tests in to sections with beginTest
beginTest ("Test section");
{
expect (1 == 1); // Test an expression for true
expectEquals (1, 1); // Test two values are equal
expectNotEquals (1, 1); // Test two values are not equal: FAILS
}
}
};
// Creates an instance of the test so you can run it
static TestClassName testClassName;
// Call this from your applications
inline void runTest()
{
juce::UnitTestRunner runner;
runner.runTests ({ &testClassName });
}
Operating systems
Windows
What versions of the operating systems?
Windows 11
Architectures
x86_64
Stacktrace
'''
> Benchmarks.exe!juce::LeakedObjectDetector<juce::OggReader>::LeakCounter::~LeakCounter() Line 104 C++
[External Code]
Benchmarks.exe!_execute_onexit_table::__l2::<lambda>() Line 206 C++
Benchmarks.exe!__crt_seh_guarded_call<int>::operator()<void <lambda>(void),int <lambda>(void) &,void <lambda>(void)>(__acrt_lock_and_call::__l2::void <lambda>(void) && setup, _execute_onexit_table::__l2::int <lambda>(void) & action, __acrt_lock_and_call::__l2::void <lambda>(void) && cleanup) Line 204 C++
Benchmarks.exe!__acrt_lock_and_call<int <lambda>(void)>(const __acrt_lock_id lock_id, _execute_onexit_table::__l2::int <lambda>(void) && action) Line 974 C++
Benchmarks.exe!_execute_onexit_table(_onexit_table_t * table) Line 231 C++
Benchmarks.exe!common_exit::__l2::<lambda>() Line 221 C++
Benchmarks.exe!__crt_seh_guarded_call<void>::operator()<void <lambda>(void),void <lambda>(void) &,void <lambda>(void)>(__acrt_lock_and_call::__l2::void <lambda>(void) && setup, common_exit::__l2::void <lambda>(void) & action, __acrt_lock_and_call::__l2::void <lambda>(void) && cleanup) Line 224 C++
Benchmarks.exe!__acrt_lock_and_call<void <lambda>(void)>(const __acrt_lock_id lock_id, common_exit::__l2::void <lambda>(void) && action) Line 974 C++
Benchmarks.exe!common_exit(const int return_code, const _crt_exit_cleanup_mode cleanup_mode, const _crt_exit_return_mode return_mode) Line 253 C++
Benchmarks.exe!exit(int return_code) Line 288 C++
[External Code]
'''
Plug-in formats (if applicable)
No response
Plug-in host applications (DAWs) (if applicable)
No response
Testing on the develop branch
I have not tested against the develop branch
Code of Conduct
- I agree to follow the Code of Conduct
- Dominant language
- C++
- Stars
- 1.5k
- Forks
- 222
- Avg merge
- 15h 44m
- Merged PRs (30d)
- 33
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Tracktion/tracktion_engine
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Tracktion/tracktion_engine#475 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
Tracktion/tracktion_engine#476 · 5 comments ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 22/100
Tracktion/tracktion_engine#474 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
Tracktion/tracktion_engine#473 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 56/100
Tracktion/tracktion_engine#460 ·
Maintainers usually reply within 1 day
All issues in Tracktion/tracktion_engine
Similar issues
-
P2: A timed rotation maneuver does nothing on a ship that had an earlier timed lateral maneuverOpen
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
scp-fs2open/fs2open.github.com#7914 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
eclipse-score/inc_someip_gateway#356 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
HarperFast/rocksdb-js#945 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day