Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: investigate why addNodes method often throws FK violations #457

Open
JannikStreek opened this issue Sep 13, 2024 · 1 comment
Open
Assignees
Labels
bug Something isn't working

Comments

@JannikStreek
Copy link
Member

JannikStreek commented Sep 13, 2024

Describe the bug
Method addNodes in maps.service.ts:

[Nest] 54  - 09/13/2024, 6:20:04 AM   ERROR [WsExceptionsHandler] insert or update on table "mmp_node" violates foreign key constraint "FK_336300b82c56a05f0317f229420"
2024-09-13 08:20:03.972	
    at async MapsService.updateMap (/home/node/app/teammapper-backend/src/map/services/maps.service.ts:176:5)
2024-09-13 08:20:03.972	
    at async MapsService.addNodesFromClient (/home/node/app/teammapper-backend/src/map/services/maps.service.ts:80:12)
2024-09-13 08:20:03.972	
    at async reducer (/home/node/app/teammapper-backend/src/map/services/maps.service.ts:93:31)
2024-09-13 08:20:03.972	
    at async reducer (/home/node/app/teammapper-backend/src/map/services/maps.service.ts:95:40)

This method is called for pasting and importing a whole map. Investigate possible causes. Potential problems could be multiple concurrent json imports and a race condition, or the paste/cut functions.

Possible solutions
Importing a map should be a mutual exclusive operation, therefore, the map should be locked during this time. We could kill all socket connections to the map before and then do the import. And reload after the import is finished on the client side.

@JannikStreek JannikStreek added the bug Something isn't working label Sep 13, 2024
@JannikStreek JannikStreek self-assigned this Sep 13, 2024
@sorenjohanson
Copy link
Collaborator

It's used when importing, copy/pasting but also when duplicating the map. Tried to reproduce with 3 clients, but I never managed to get this error even once. Maybe this'll be fixed once we merge #467.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants