cytomine/Cytomine-bootstrap

Inconsistent annotation count in projects

ioan02 opened this issue · 4 comments

Describe the bug

  • Have you followed our documentation ?
    The installation was handled using the official documentation with little customization.
  • Description :
    The manual annotation count displayed in the Information section (in the left pane of the UI for a given project) is incorrect.

Steps to reproduce:

  1. connect to the platform
  2. create a new project
  3. add a new image to the project
  4. add 2 manual annotations to that image
  5. delete the image

When checking the Information section for the project, the number of annotations is -2 whereas it would be expected to be 0.
On repeat, it shows -4. If a new image is added and a new manual annotation is made, it displays a count of 1.

Copy your configuration file
Using the provided defaults, except for the URLs section:
configuration.sh

#URLs
CORE_URL=localhost-core
IMS_URL1=localhost-ims
IMS_URL2=localhost-ims2
UPLOAD_URL=localhost-upload

/etc/hosts on remote server
127.0.0.1 localhost-core localhost-ims localhost-ims2 localhost-upload
/etc/hosts on client server
$remote_server_public_ip localhost-core localhost-ims localhost-ims2 localhost-upload

Web context:
As Cytomine is a web platform, give us any information that will help us to identify the problem.

  • Is it installed on a remote server or on your local machine ?
    The platform is installed on a remote AWS server meeting the requirements (8CPU 16G RAM), but we have encountered the same problem running on Azure inside a AKS cluster.
  • Which operating system and distribution is running ?
    Running on a Debian 10 clean install.

Thanks for using the template ! :D

@loic911 : Can you inspect it ?

Which Cytomine version do you use?
Do you have a valid annotation number in project listing (Projects button on the top of the screen)?
Screenshot from 2022-02-03 11-13-05

I cannot reproduce this issue. I will check the code to see if I can identify the problem.

@geektortoise However, I've identified another issue with counter.
After creating an annotation, the information section still shows 0 annotations (same for 0 images).
Screenshot from 2022-02-03 11-12-42
While the project listing shows 1 annotation (see my first screenshot).
I suppose that the trigger/psql procedure update the project row in database (annotation ++) but the "project" object instance is still in Hibernate session / cache so the value is still 0. If I force an update to the project (e.g. rename it), the counters are now correct because the entity is reloaded from database.
Screenshot from 2022-02-03 11-13-45

Hi,

This is an issue that I already fixed some time ago in ULiege fork, but I thought it has already been cherry-picked in the community edition :/.

When an image is deleted, the database delete trigger for image updates the project annotation counter by removing the number of annotations in that image. The delete dependency management system for the image deletion will also delete the related annotations one by one, leading to a database delete trigger for annotation, which remove 1 from the project counter.

Deleted annotations are thus uncounted twice when an image is removed.

Hi,

Thank you all for the quick replies.
For my tests I used the snippet from the documentation without checking the version, which is v3.0.3 for cytomine-core. I believed I was using the latest version but that was not the case.
I tested again with v3.0.4 for cytomine core and the counters are indeed refreshed correctly within a short delay.

My apologies and thanks again :)