GNS3 / gns3-server

GNS3 server
GNU General Public License v3.0
811 stars 263 forks source link

Openning the same project multiple times creates problems #81

Closed grossmj closed 9 years ago

grossmj commented 9 years ago

Steps to reproduce:

Start a GUI and load a project. Start a second GUI and load the same project At this point error messages like these can been seen (expected):

Response error: Error downloading http://127.0.0.1:8000/v1/projects/89bb17b3-de47-4dba-bdac-35e1d09b4ef9/dynamips/vms - server replied: Conflict
error while setting up R1: TCP port 2001 already in use on host
Server error from 127.0.0.1:8000: R1: TCP port 2001 already in use on host
Response error: Error downloading http://127.0.0.1:8000/v1/projects/89bb17b3-de47-4dba-bdac-35e1d09b4ef9/dynamips/vms - server replied: Conflict
error while setting up R2: TCP port 2002 already in use on host
Server error from 127.0.0.1:8000: R2: TCP port 2002 already in use on host
Response error: Error downloading http://127.0.0.1:8000/v1/projects/89bb17b3-de47-4dba-bdac-35e1d09b4ef9/dynamips/vms - server replied: Conflict
error while setting up R3: TCP port 2003 already in use on host
Server error from 127.0.0.1:8000: R3: TCP port 2003 already in use on host
FR1 has been created

Close the second GUI. Close the first GUI.

Errors like these can be seen and we cannot close the GUI (similar to bug https://github.com/GNS3/gns3-server/issues/80)

Response error: Error downloading http://127.0.0.1:8000/v1/projects/89bb17b3-de47-4dba-bdac-35e1d09b4ef9/close - server replied: Not Found
Error while closing project 89bb17b3-de47-4dba-bdac-35e1d09b4ef9: Project ID 89bb17b3-de47-4dba-bdac-35e1d09b4ef9 doesn't exist

Proposed solution: when loading a topology we should try to create the project just once. This can be implemented in the createNode() method of each module class (e.g. https://github.com/GNS3/gns3-gui/blob/rest-api/gns3/modules/vpcs/__init__.py#L167) like it was done in the old GUI. This should be combined with a server version check.

On the server side in project manager we send an error if the project is already openned: https://github.com/GNS3/gns3-server/blob/asyncio/gns3server/modules/project_manager.py#L73

julien-duponchelle commented 9 years ago

I see two issues:

julien-duponchelle commented 9 years ago

I have fix the issues related for the double open

julien-duponchelle commented 9 years ago

About the close issue. What did you think about preventing close of a project if a a client listen the notification feed?

julien-duponchelle commented 9 years ago

We need to discuss the reopening project by phone i think we have some corner cases ...

julien-duponchelle commented 9 years ago

Tested it's work fine with the notification feed. The system checking if another client is not connected work.