inception-project / inception

INCEpTION provides a semantic annotation platform offering intelligent annotation assistance and knowledge management.
https://inception-project.github.io
Apache License 2.0
584 stars 148 forks source link

Spurious concurrent modification exception in annotation editor #4454

Open reckart opened 7 months ago

reckart commented 7 months ago

Describe the bug Occasionally, when performing an action in the annotation editor, a concurrent modification of the CAS is detected.

To Reproduce At the moment it is unclear how to provoke this action.

Expected behavior Unless any of of the following situations occur, no concurrent modification should be reported:

Screenshots

Error: While [writing], the file system CAS storage detected a concurrent modification to the annotation CAS for user [[USER@DOMAIN.onmicrosoft.com](mailto:USER@DOMAIN.onmicrosoft.com)] in document [FILE.pdf](866) or project [Project 5 - Batch 3](40) (expected: 2024-01-24 07:19:48.928 actual on storage: 2024-01-24 06:56:21.310, delta: 00:23:27.618), accuracy: 1000ms.

Please complete the following information:

Additional context

77neel commented 6 months ago

Environment Detail:

reckart commented 6 months ago

On the mailing list, you wrote that you see lost annotations. To what extend do you see those? Is only the last action performed lost or is the document actually reset to a much older state or even looses all of its annotations.

On the mailing list, you note that Azure Defender might mess with the timestamp. IMHO Azure Defender should not change files, right? So it should not change the "last modified" timestamp of the file that INCEpTION uses - if anything, it should only change the "last access" timestamp.

77neel commented 6 months ago

Out of 7, 4 files had annotation lost up to 80% approx.

About Azure Defender, sorry I am not sure.

reckart commented 6 months ago

Could you set the log level of de.tudarmstadt.ukp.inception.annotation.storage to trace and add the line cas-storage.trace-access=true to you settings.properties. That should give us a lot of information who is reading/writing what when.

Do you get the error message suddenly during annotation or e.g. after a while of not having done anything (e.g. after a pause)?

reckart commented 6 months ago

@77neel a user on the mailing list reported that time stamp problems on azure disappeared when using an Azure VM with attached storage. Maybe that is an option that you could try.

77neel commented 6 months ago

@reckart I faced (above mentioned) error message suddenly during annotation when "cas-storage.file-system-timestamp-accuracy" value was not increased (to 30 minutes).

After increasing value, No error appeared.

Missing of annotated data where there before and after changing property value.

I faced one error appeared in log recently while curating file :

USER@DOMAIN.onmicrosoft.com: Unable to perform action: Cannot invoke "de.tudarmstadt.ukp.inception.recommendation.api.model.Predictions.getPredictionByVID(de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument, de.tudarmstadt.ukp.inception.rendering.vmodel.VID)" because "predictions" is null

reckart commented 6 months ago

The "predictions is null" error is likely unrelated - but can you provide a stack strace for it please? That would help locating the problem in the code.

reckart commented 6 months ago

@77neel If you increase cas-storage.file-system-timestamp-accuracy to a very high value, the error message is suppressed. But if you still lose data, what is the point in suppressing the message? When you do not get the message, you will not even know that you might have lost data.

Also, if you get the error message and have set storage.trace-access=true as well, then in the logs, there should be two stack traces logged: one for the last successful write and one for the current write that encounters the wrong timestamp. Along with the trace logging, maybe that helps us narrow down what is happening.

reckart commented 6 months ago

@77neel In your case, the problem appears on writing and at least according to the timestamps, the data that is going to be written appears to be way newer than the data on disk. So what we could try is to add an option to relax the check a bit in such a way that no error is generated if the data to be written remembers a newer timestamp - because hopefully the data in fact is newer. That may remove the problem for you. However, in general, I would not find this a particularly satisfactory solution because the we still do not know the root cause of the problem...

77neel commented 6 months ago

@reckart I decreased "cas-storage.file-system-timestamp-accuracy" value to 500ms but I haven't encounter that error again and no data lost. I am also not sure why it working fine now. Will let you know once I find more details on this matter.