Ticket #175 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

Unique constraint violation in clustered mode

Reported by: e.ropartz Owned by:
Priority: critical Milestone:
Component: zoo-kernel Version:
Keywords: cluster Cc:

Description

Hi,

We used zooproject in a clustered mode. So we have a database backend to share ongoing informations of running services between 2 ZOO-Kernel instances. When the load on the cluster increases, some requests fails due to databases errors :

ERROR 1: ERROR: duplicate key value violates unique constraint "services_osid_key" DÉTAIL : Key (osid)=(1593003150) already exists. ERROR 1: ERROR: insert or update on table "responses" violates foreign key constraint "responses_uuid_fkey" DÉTAIL : Key (uuid)=(519e1ea2-b481-11ea-917c-005056b8dc20) is not present in table "services".

  • The osid value calculated by the kernel is not unique

The osid is calculated by the script zoo-project/zoo-kernel/zoo_service_loader.c (line 830) : sprintf (tmpBuff, "%i", (cpid + ((int) tp.tv_sec + (int) tp.tv_usec)));

  • In some cases, the PID variation is cancelled by the timestamp variation

Change History

Changed 4 years ago by djay

Hi, sorry for late reply.

Thanks for using the ZOO-Project.

The issue is probably due to the fact that when you run an asynchronous request there is a fork invocation but, the OGR connection to the PostgreSQL backend is created before the fork. Hence, creating another connection after fork is invoked should solve this issue.

Removing the osid unique constraint should not hurt.

Changed 4 years ago by djay

In ticket #177 samsouk was able to reproduce your issue initially before adding the pgbouncer container in docker-compose.

The commit r959 solve also the issue with unique constraint.

I hope you can confirm that this configuration will suit your needs.

I close this ticket as it should now be solved. Please, feel free to re-open the ticket at any time.

Changed 4 years ago by djay

  • status changed from new to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png