BEXIS2 / Core

This is the public code repository of the BEXIS2 data management software. It contains only modules, components, and packages of the core system. Contributed modules and components will be available in separate repositories. For more information on BEXIS2, please visit our website.
https://bexis2.github.io/
17 stars 13 forks source link

Show Primary Data return HTTP-error 500 #1606

Open sventhiel opened 7 months ago

sventhiel commented 7 months ago

What is going wrong?

In some "rare" cases it might happen, that the user will get back a HTTP-error 500, because the source code behind breaks. Initially, this issue was identified by @Hamdi1992. I checked it with other BEXIS2 systems. At first, I was not able to reproduce, but only because I checked "unstructured" datasets. At least for them, the issue seems not to exist.

How is it supposed to work?

So, the system should handle on the thrown error accordingly. The user should not get the "alert"-like error message. May it is possible to mask the issue. On the other hand, there could be "simple" solutions on how to circumvent that kind of issue. By that, it either be necessary to change the source code, or the existing data within the database - and ensure that future data is inserted differently (or lets say correctly).

How can it be reproduced?

You need to find a structured dataset whereby some versions of it have NULL inside the column m_comment within the table datasetversions. Next, you have to have the following setup:

  1. A version x of that dataset contains primary data.
  2. There is another version y, such that x < y and the field m_comment is NULL for y - which means, that there is a newer version than x with NULL at m_comment.
  3. Select version x within your BEXIS2 system.
  4. Go to Primary Data.
  5. Wait a bit and get the error (HTTP-error 500).

Within the source code, there is a count on data changes from between version x and newer version to decide from where the primary data should be loaded. But there are some entries that have NULL, so the check will break.

https://github.com/BEXIS2/Core/blob/4b10d7322d2d6c5efb572c4b10bc38018f92ca26/Console/BExIS.Web.Shell/Areas/DDM/Controllers/DataController.cs#L585

Do you get any exceptions?

Yes, please check out the screen.

image

geofranzi commented 7 months ago

just make it nullable, or?

introduced here: https://github.com/BEXIS2/Core/issues/823

sventhiel commented 7 months ago

Yes, at least there are two solutions from my side:

  1. The check should include null, to exclude those entities already. By that, the check will not look for child-properties of a null object.
  2. Change the database entries for all occurences from null to '', because if the object is empty, may the child-property check won't fail.

The second solution (regardless if '' or something else, may need changes/modifications in the general model, because ALL entries should have a value that is different from null, which is not the case right now. So at the moment, there are ways to introduce an entry within the db, that has null.