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

getCurrentVersionNumber() of VirtualModule crashes due to missing owner #30

Open
zenker opened this issue Apr 2, 2019 · 6 comments
Open
Labels
bug redmine Issue tracked on DESY MSK Redmine

Comments

@zenker
Copy link
Collaborator

zenker commented Apr 2, 2019

I guess that should not happen when using ApplicationCore in the correct way, but currently my application crashes at this point since owner is a nullptr in my case:

VersionNumber getCurrentVersionNumber() const override { return _owner->getCurrentVersionNumber(); }

Better throw an exception and if possible give a hint how to solve the problem.

@mhier
Copy link
Member

mhier commented Apr 2, 2019

Why does your module not have an owner? What type of module are you talking about?

@zenker
Copy link
Collaborator Author

zenker commented Apr 2, 2019

I found out how the owner is a nullptr. In my ApplicationModule in the mainLoop method I call findTag("SYS").writeAll(). Here findTag will create a VirtualModule:

VirtualModule module{_name, _description, getModuleType()};

This VirtualModule has no owner:
: Module(nullptr, name, description), _moduleType(moduleType) {

And finally when writeAll() is called the problem descibed above happens:
auto versionNumber = getCurrentVersionNumber();

@mhier
Copy link
Member

mhier commented Apr 2, 2019

Ah ok, so we have to somehow override getCurrentVersionNumber() in VirtualModules to obtain the version number properly from the corresponding ApplicationModule.

Btw: findTag() might be very slow. I would recommend running it once at the beginning of mainLoop() and then later only use the VirtualModule to run writeAll() on. I had not foreseen this use case, but it might be nice and handy, so we should support it.

@mhier mhier added the bug label Apr 2, 2019
@mhier mhier changed the title Crash when getting version number without owner getCurrentVersionNumber() of VirtualModule crashes due to missing owner Apr 2, 2019
@mhier
Copy link
Member

mhier commented Sep 11, 2020

I think this is fixed, but a test is still missing. So the task is to write a small test that writeAll() and readAll() properly work and get/set the version number from the true owner.

@zenker
Copy link
Collaborator Author

zenker commented Nov 11, 2020

I just tested with the master branch and the problem is still present.

@mhier
Copy link
Member

mhier commented Jun 16, 2021

Now tracked on redmine: #8361

@mhier mhier added the redmine Issue tracked on DESY MSK Redmine label Jun 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug redmine Issue tracked on DESY MSK Redmine
Projects
None yet
Development

No branches or pull requests

2 participants