node-red-quantum / node-red-contrib-quantum

Quantum computing functionality for Node-RED
https://node-red-quantum.github.io/
Apache License 2.0
16 stars 2 forks source link

Flow freezes when there are 2 quantum circuit #106

Open ttoktassynov opened 2 years ago

ttoktassynov commented 2 years ago

Bug Description

When two quantum circuits start sending messages at the same time the flow freezes.

Steps to Reproduce Bug

Connect two quantum circuit nodes to the inject node and start the flow, as in picture: Screen Shot 2021-08-29 at 21 00 08

Expected Behaviour & Actual Behaviour

Expected behavior is that debug node would receive as many qubit payload objects as there are qubits in both circuits. Actual behavior is freezing of the flow.

Additional Information

System Information

Theo-Reignier commented 2 years ago

For now, 'Node-RED Quantum' requires the user to have a single quantum circuit at a time, but as many quantum algorithms nodes at a time.

ttoktassynov commented 2 years ago

Then, @KhesimReid , we don’t need to test scenario when qubits come from different circuits?

Theo-Reignier commented 2 years ago

Then, @KhesimReid , we don’t need to test scenario when qubits come from different circuits?

Well, the error handling is here in case the user creates 2 quantum circuits regardless. Not sure if we really need to test it though.

KhesimReid commented 2 years ago

Then, @KhesimReid , we don’t need to test scenario when qubits come from different circuits?

Well, the error handling is here in case the user creates 2 quantum circuits regardless. Not sure if we really need to test it though.

The test would have been to ensure that the error handling works appropriately, since having the correct errors returned to the users is very important so that they don't get confused when things go wrong. However, given the time left, if the issue prevents the tests from being written then I wouldn't worry about doing it now.

louislefevre commented 2 years ago

This issue happens because all quantum circuits use the same Python shell instance. However, what we can perhaps do is create separate shell instances for every circuit and store it in the global state manager.

ttoktassynov commented 2 years ago

This would have been nice, since circuits should be independent of each other.