Mir

Segmentation fault in MesaBufferIntegration.*

Bug #1495459 reported by Alan Griffiths
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mir
Fix Released
Medium
Alan Griffiths
mir (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

$ LD_PRELOAD=libumockdev-preload.so.0 bin/mir_integration_tests --gtest_filter=MesaBufferIntegration.*
MIR_CLIENT_PLATFORM_PATH=bin/../lib/client-modules/
MIR_SERVER_PLATFORM_PATH=bin/../lib/server-modules/
LD_LIBRARY_PATH=/home/alan/bin/clion-1.1/bin::bin/../lib
exec=bin/mir_integration_tests.bin
Running main() from main.cpp
Note: Google Test filter = MesaBufferIntegration.*
[==========] Running 3 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 3 tests from MesaBufferIntegration
[ RUN ] MesaBufferIntegration.buffer_creation_from_arbitrary_thread_works
[1442227540.564035] mirplatform: Found graphics driver: android
[1442227540.565387] mirplatform: Found graphics driver: mesa-x11
[1442227540.565869] mirplatform: Found graphics driver: mesa-kms
[1442227540.566018] mirplatform: Found graphics driver: dummy
Segmentation fault (core dumped)

This *may* have something to do with loading and discarding the server-mesa-x11.so.5 module, as deleting that prevents the error. (And reinstating it restores the error.)

Related branches

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Another workaround: specify the platform graphics library...

$ LD_PRELOAD=libumockdev-preload.so.0 bin/mir_integration_tests --gtest_filter=MesaBufferIntegration.* --platform-graphics-lib lib/server-modules/graphics-dummy.so

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

OK, it looks like selecting the X11 lib is the problem, not probing it...

$ LD_PRELOAD=libumockdev-preload.so.0 bin/mir_integration_tests --gtest_filter=MesaBufferIntegration.* --platform-graphics-lib lib/server-modules/server-mesa-x11.so.5
MIR_CLIENT_PLATFORM_PATH=bin/../lib/client-modules/
MIR_SERVER_PLATFORM_PATH=bin/../lib/server-modules/
LD_LIBRARY_PATH=bin/../lib
exec=bin/mir_integration_tests.bin
Running main() from main.cpp
Note: Google Test filter = MesaBufferIntegration.*
[==========] Running 3 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 3 tests from MesaBufferIntegration
[ RUN ] MesaBufferIntegration.buffer_creation_from_arbitrary_thread_works
Segmentation fault (core dumped)

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

For completeness:

$ LD_PRELOAD=libumockdev-preload.so.0 bin/mir_integration_tests --gtest_filter=MesaBufferIntegration.* --platform-graphics-lib lib/server-modules/graphics-mesa-kms.so.5
MIR_CLIENT_PLATFORM_PATH=bin/../lib/client-modules/
MIR_SERVER_PLATFORM_PATH=bin/../lib/server-modules/
LD_LIBRARY_PATH=bin/../lib
exec=bin/mir_integration_tests.bin
Running main() from main.cpp
Note: Google Test filter = MesaBufferIntegration.*
[==========] Running 3 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 3 tests from MesaBufferIntegration
[ RUN ] MesaBufferIntegration.buffer_creation_from_arbitrary_thread_works
[ OK ] MesaBufferIntegration.buffer_creation_from_arbitrary_thread_works (2 ms)
[ RUN ] MesaBufferIntegration.buffer_destruction_from_arbitrary_thread_works
[ OK ] MesaBufferIntegration.buffer_destruction_from_arbitrary_thread_works (0 ms)
[ RUN ] MesaBufferIntegration.buffer_lazy_texture_instantiation_from_arbitrary_thread_fails
[ OK ] MesaBufferIntegration.buffer_lazy_texture_instantiation_from_arbitrary_thread_fails (1 ms)
[----------] 3 tests from MesaBufferIntegration (3 ms total)

[----------] Global test environment tear-down
[==========] 3 tests from 1 test case ran. (4 ms total)
[ PASSED ] 3 tests.

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Hmm, there's no obvious reason for this test suite to be probing the graphics platform anyway.

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Oh! It's the code to load platform specific config options.

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Specifically, it is the following line that triggers the problem:

$ bzr diff
=== modified file 'src/platforms/mesa/server/x11/graphics/graphics.cpp'
--- src/platforms/mesa/server/x11/graphics/graphics.cpp 2015-09-11 14:19:21 +0000
+++ src/platforms/mesa/server/x11/graphics/graphics.cpp 2015-09-14 13:40:50 +0000
@@ -66,7 +66,7 @@
 {
     config.add_options()
         (x11_displays_option_name,
- boost::program_options::value<std::string>()->default_value("1280x1024"),
+// boost::program_options::value<std::string>()->default_value("1280x1024"),
          "[mir-on-X specific] WIDTHxHEIGHT of \"display\" window.");
 }

Changed in mir:
milestone: none → 0.16.0
assignee: nobody → Alan Griffiths (alan-griffiths)
status: New → In Progress
importance: Undecided → Medium
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

In the test SetUp() we have the line:

    auto options = mtf::TestingServerConfiguration().the_options();

There are two significant objects created here:

1. a temporary TestingServerConfiguration
2. a named shared_ptr<Option>

the first is destroyed at the the end of the above statement, the second exists until the end of scope.

If we modify the code to name the TestingServerConfiguration (so that it exists until after "options" is deleted) then the crash stops happening.

This leads me to believe that setting the default value on the option (as mentioned above) is creating an object whose destructor is instantiated in the server-mesa-x11 module. (I'm not sure of the mechanism but, empirically, the library is unloaded by ~TestingServerConfiguration()).

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

Fix committed into lp:mir at revision None, scheduled for release in mir, milestone 0.16.0

Changed in mir:
status: In Progress → Fix Committed
Changed in mir:
status: Fix Committed → Fix Released
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

mir (0.16.0+15.10.20150921.1-0ubuntu1) wily; urgency=medium

Changed in mir (Ubuntu):
importance: Undecided → Medium
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.