Hi,
We're using the Java version of the FIT SDK for parsing and creating FIT files in our server application.
We have a rather large test suite and have started noticing that some of our tests started failing with the same errors time when we run the complete test suite. When we run the tests individually, they do succeed.
We've added extra logging and found the following:
In the circumstances that the tests go wrong, we RecordMesg objects in our RecordMesgListener that contain heart rate values of 255. For the same file, and the same RecordMesg, the value is null in the correct runs (null is the correct value here).
We see the same thing with values for the power, cadence, enhanced_speed and enhanced_altitude fields, though the values are different there because these values have different types.
Of course, we first suspected that our inputs were off, i.e. that we were sending corrupt data. So we checked the contents of the fit files using an MD5 hash digest. Contents turned out not to be different between runs, so that was not the issue.
Following this, we looked at the SDK's code and found that it is obviously stateful, because the class com.garmin.fit.Decode has a static boolean property invalidDataSize. Because of this we put an excluse lock around the FIT decoding code. This should prevent a problem with invalidDataSize being in a faulty state, but it does not fix the problem above.
Our conclusion is that there is some residual state in the SDK after having parsed a FIT file. We do create new Decode and MesgBroadcaster objects for each FIT file that we parse, so that is not the cause of the issue.
Is this expected behavior, and if so, how should we work around it in a long-running server application?
Thank you,
Ilja Booij
JOIN Sports BV