#635 Player starts alwayson drivers before listening to TCP ports

Player (393)

When player is starting up it starts and subscribes to all of the alwayson drivers before it starts listening to its TCP/UDP connections. This is an issue as it can result in a conditional jump depending on an uninitilised value (see valgrind output below) and also causes remote drivers to be used to connect to to other driver running on the player server.

Valgrind output - here GraphicsAdapter is a nonthreaded plugin driver and inroPlannerDriver is a threaded plugin driver, both running on the same port in the same server:

==24315== Conditional jump or move depends on uninitialised value(s)
==24315== at 0x59ED982: PlayerTCP::Listening(int) (in /usr/lib/libplayertcp.so.2.1.4)
==24315== by 0x59F0D87: TCPRemoteDriverConnection::Connect() (in /usr/lib/libplayertcp.so.2.1.4)
==24315== by 0x53D7AAC: RemoteDriver::Connect(QueuePointer const&, player_devaddr const&) (in /usr/lib/libplayercore.so.2.1.4)
==24315== by 0x53D88F0: RemoteDriver::Subscribe(QueuePointer&, player_devaddr) (in /usr/lib/libplayercore.so.2.1.4)
==24315== by 0x53CD3AE: Device::Subscribe(QueuePointer&) (in /usr/lib/libplayercore.so.2.1.4)
==24315== by 0x1F1A3136: GraphicsAdapter::Setup() (graphicsadapter.cpp:99)
==24315== by 0x53CB43B: Driver::Subscribe(player_devaddr) (in /usr/lib/libplayercore.so.2.1.4)
==24315== by 0x53CD49E: Device::Subscribe(QueuePointer&) (in /usr/lib/libplayercore.so.2.1.4)
==24315== by 0x1DEB35EF: inro::BaseRequire::Subscribe() (baserequire.cpp:93)
==24315== by 0x20698677: InroPlannerDriver::MainSetup() (inroplanner.cpp:278)
==24315== by 0x53CCBAB: ThreadedDriver::DummyMain(void*) (in /usr/lib/libplayercore.so.2.1.4)
==24315== by 0xAC0A9C9: start_thread (pthread_create.c:300)

The unconditional jump is occurring because the Listening() call requires Listen(...) to have been called to set up the data it is comparing to, the remote driver construction is also evident.

The attached patch moves the starting of the alwayson driver to below the TCP port setup and I believe should cause no side effects.

This has been tested on a modified 2.1.4 branch and compiles under SVN trunk (rev. 9036) and as the section of the code hasn't changed between those revisions I think that it should still be valid.


  • Chris

    Chris - 2011-02-08

    svn diff from the server dir

  • Rich Mattes

    Rich Mattes - 2011-02-16

    The changes have been made in SVN trunk.
    Thank you for your contribution.

  • Rich Mattes

    Rich Mattes - 2011-02-16
    • status: open --> closed-accepted

Log in to post a comment.