[Loris-dev] Error on data dictionary

Dave MacFarlane dave.macfarlane at mcin.ca
Tue Nov 16 12:29:45 EST 2021


Hi Eli,

I'm not able to reproduce this on the raisinbread dataset. It sounds like
LORIS is generating the "Content-Length" header based on the json data, but
something is printing newlines before the output is sent, resulting in the
browser reading those, and then stopping reading once Content-length bytes
are read.

The main change in the diff between the v23.0.0 and v23.0.8 versions in the
module seems to be that it instantiates instruments to get the table name
now, suggesting it might be a problem originating from one of your
instruments. I tried adding a print newline into the setup function of an
arbitrary instrument and got warnings such as:

*Warning*: Cannot modify header information - headers already sent by
(output started at
/home/driusan/Code/Loris/project/instruments/NDB_BVL_Instrument_mri_parameter_form.class.inc:53)
in */home/driusan/Code/Loris/htdocs/index.php* on line *60*

but it's possible that the display of the warning is php.ini sensitive. I
also tried adding newlines after the PHP closing tag in some files and got
the same warning.

Those warnings some from the PHP side, but on the loris side there should
also be an error logged to your apache logs if there's a problem
instantiating the instrument:

error_log(
"There was a problem instantiating the instrument ".
"'$instrument'. Make sure the instrument is valid and ".
"functional in order for it to be displayed in the data ".
"dictionary."
);

It shouldn't cause newlines to be printed, but it's possible that something
in the attempt to instantiate the instrument does. Do you get that error in
your logs?

- Dave

On Thu, Nov 11, 2021 at 7:17 PM Eli Johnson <joh17964 at umn.edu> wrote:

> Hi Dave,
>
> I reverted to the v23.0.0 version of the datadict module and it's working
> properly again.
>
> I did inspect the returned values -- the json data package returned by
> "<lorisurl>/datadict/?format=json" appears to be cut off. For some reason
> it looks like ~40 newlines have been added before the json begins and then
> an equivalent number of characters have been cut off from the end. I didn't
> find any obvious issues when briefly inspecting the v23.0.8 changes to
> php/datadict.class.inc but something there appears to be the source of the
> issue.
>
> Best,
> Eli
>
>
> Eli Johnson
> Developer/Data Manager
> Institute of Child Development
> University of Minnesota
> joh17964 at umn.edu
>
>
> On Thu, Nov 11, 2021 at 8:24 AM Dave MacFarlane <dave.macfarlane at mcin.ca>
> wrote:
>
>> Hi Eli,
>>
>> I'm not sure why that would have broken between 2 bug fix releases, but
>> the error "SyntaxError: Unexpected end of JSON input" implies that the
>> attempt to fetch the fields returned invalid input. This can happen if, for
>> instance, an exception is thrown by the ajax request. If you open the
>> network tab* in your developer tools before loading the page there should
>> be a request for "(your url)/datadict/fields". Click on that, and then the
>> "Response" tab* in the network tools and you should get a better idea of
>> what's being returned to debug.
>>
>> * That's how they're labeled in Firefox. I'm not sure off the top of my
>> head what the labels are in Chrome but it should be similar.
>>
>> On Wed, Nov 10, 2021 at 2:29 PM Eli Johnson <joh17964 at umn.edu> wrote:
>>
>>> Hi,
>>>
>>> I am updating from LORIS v23.0.2 to v23.0.8 (running on RHEL7).
>>> Everything is working except the data dictionary. I'm getting an error when
>>> trying to load the data dictionary module. The data dictionary page
>>> contains the text "An error occurred while loading the page", there is
>>> nothing logged in the apache error-log, the browser console reports
>>> "SyntaxError: Unexpected end of JSON input" on dataDictIndex.js:49.  I'm
>>> not super familiar with react so I'm not sure how to find the source of the
>>> error although it looks like it's occurring on *fetchData*. Any idea
>>> why this would happen or suggestions on how to debug?
>>>
>>> Thanks,
>>> Eli
>>>
>>> Eli Johnson
>>> Developer/Data Manager
>>> Institute of Child Development
>>> University of Minnesota
>>> joh17964 at umn.edu
>>> _______________________________________________
>>> Loris-dev mailing list
>>> Loris-dev at bic.mni.mcgill.ca
>>> https://mailman.bic.mni.mcgill.ca/mailman/listinfo/loris-dev
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.bic.mni.mcgill.ca/pipermail/loris-dev/attachments/20211116/2894e433/attachment.html>


More information about the Loris-dev mailing list