MantisBT - JANA
View Issue Details
0000362JANABugpublic2013-06-28 08:162014-01-23 09:40
davidl 
davidl 
normalminoralways
resolvedfixed 
0000362: null_data_source not defined
This is actually a couple of issues. These are related and came up while implementing the translation table in the DAQ and TTab plugins. The desired behavior was to have the DAQ plugin create low level objects and the TTab plugin take those and generate detector hit objects. If only the DAQ plugin is present, no translation is done. If the TTab plugin is present, then translation is done automatically.

This was to be achieved by simply calling JEventLoop::GetSingle from GetObjects to get a DTranslationTable object that can then be used to generate the hit objects by applying the table (via the ApplyTranslationTable method). The issues that came up were:

1.) When calling JEventLoop::Get from a JEventSource::GetObjects method, an infinite recursion is entered and doesn't stop until an "illegal instruction" is encountered. It would be good to have some way of detecting this for event sources as is done for factories.

2.) The temporary solution was to use GetFromFactory instead of GetSingle. This, however, gave a run time link error saying "null_data_source" was not defined. Giving an explicit argument of JEventLoop::DATA_FROM_FACTORY also doesn't work since the argument requires a reference. A temporary variable must then be defined so a reference to it can be passed. In the end the code looked like this:

JEventLoop::data_source_t type = JEventLoop::DATA_FROM_FACTORY; // (this needs to get fixed in JANA)
loop->GetFromFactory(translationTables, "", type);

when it could have looked like this:
oop->GetFromFactory(translationTables);


No tags attached.
parent of 0000393closed  janadot broken by fix for bug 362 
Issue History
2013-06-28 08:16davidlNew Issue
2013-12-13 16:23davidlNote Added: 0000579
2013-12-13 16:30davidlNote Added: 0000580
2013-12-13 16:30davidlStatusnew => resolved
2013-12-13 16:30davidlResolutionopen => fixed
2013-12-13 16:30davidlAssigned To => davidl
2014-01-23 09:40davidlRelationship addedparent of 0000393

Notes
(0000579)
davidl   
2013-12-13 16:23   
Item 1.) here is not easy to implement in a way that won't risk significant performance degradation. For normal factories, the Get method is implemented in the JFactory base class which allows us to use a "busy" flag to check quickly and easily for recursion. For event sources, the first point where we have access by the framework is in the JEventLoop::Get() method. Here, we would have to turn on call stack tracing and check it each time to ensure there is no duplicate entry. We could also put some arbitrary limit on the depth of the call stack without actually recording it, but that would have to be high enough to never be a problem for non-infinite-recursion cases, but be small enough to catch the infinite recursion cases before they caused memory errors.
(0000580)
davidl   
2013-12-13 16:30   
Made data_source by passed by value rather than by reference. Since it is an enum, it really saved almost nothing doing it by reference in the first place.