-
Notifications
You must be signed in to change notification settings - Fork 3
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
Remove DeviceModule::writeAfterOpen #144
Comments
The required test should already be done in testExceptionHandler/testConstants - but after the changes it deadlocks in that test |
This seems to be around the RecoverySharedLock(). Trace from helgrind exit status:
|
Ah. Because we are trying to call write() on the accessor while holding the unique lock on the recoverySharedMutex, which then calles the preWrite() on the ExceptionHandlingDecoratorAccessor which in its preWrite tries to get the sharedLock on the same mutex. Since it never gets that, The write will never success. |
Yes, that was a bug which was always there. A fully decorated Accessor was added to writeAfterOpen. But this was only called at the first open, where the recovery accessor was still waiting for the opening of the device. This is why it never locked. Now it is in the list of recovery accessors, which must not be decorated with the ExceptionHandlingDecorator. This causes the deadlock. Actually, the required test is already there, and the functionality always worked, because in Application.cc was calling createDeviceVariable, which creates a RecoveryAccessor. This accessor get the value when the write on the "impl" is executed in the inital open. I think it somewhat worked by accident. I will fix the code, I think I have the solution. |
Now testTrigger fails with a race condition. The timing must have changed slightly. |
Child of #123
Currently constants have a special treatment that they are written using writeAfterOpen(), while all other variables use the "recoveryAccessor" for it. In fact the list in "writeAfterOpen" is only written for the first open, which is wrong. Constant values are not recovered in the current implementation.
There are only four places where the list
writeAfterOpen
is used:Solve #133: Recovery accessors should only be written if version number is not nullptr. It is the same code as you just put into DeviceModule.cc. Just copy it. The duplication will be cleaned up in #129
Write a test that constants are written correctly (probably exists) AND are correctly recovered (does not exist yet because it is not working at the moment and nobody noticed so far)
Do not write tests that all recovery accessors are now only written if they have a valid version number. This is a separate ticket (Write tests that only valid recovery accessors are written to the device #145)
The text was updated successfully, but these errors were encountered: