11Troubleshooting SimulaQron
22==========================
33
4- This document aims to help you troubleshooting some situations that can arise while running simulaqron applications.
4+ This document aims to help you troubleshooting some situations that can arise while running SimulaQron applications.
55This documents assumes that you have read the :doc: `SimulaQron Overview <Overview >` and
66:doc: `SimulaQron Application Architecture <AppsArch >` before you proceed.
77
@@ -15,11 +15,11 @@ cannot be changed.
1515
1616Under this folder you will find:
1717
18- * *Driver log file *: Each time that you invoke que driver (``simulaqron start ``), the driver will create a general log.
19- This file will be called ``simulaqron-driver-<pid>.log ``, where "``<pid> ``" is a number corresponding to the process
18+ * *Driver log file *: Each time that you invoke the driver (``simulaqron start ``), it will create a general log. This
19+ file will be called ``simulaqron-driver-<pid>.log ``, where "``<pid> ``" is a number corresponding to the process
2020 ID as reported by the OS.
2121* *SimulaQron's QNodeOS and Virtual Node log files *: Once that the backend is running, the spawned QNodeOS and Virtual
22- Node processes will create a logs file named ``simulaqron-<qnos/vnode>-<node_name>-<pid>.log ``. From the file name
22+ Node processes will create logs file named ``simulaqron-<qnos/vnode>-<node_name>-<pid>.log ``. From the file name
2323 you'll be able to identify if the log file corresponds to QNodeOS or Virtual Node process, the node name, and the
2424 process ID as reported by the OS.
2525
@@ -31,7 +31,7 @@ How can I increase/decrease the verbosity of the log files?
3131-----------------------------------------------------------
3232
3333By default, the log verbosity level is set to "warning". This means that the information shown in the logs only
34- contains lines that are logged with severity "warning" or higher. YOu can increase the verbosity to see more debugging
34+ contains lines that are logged with severity "warning" or higher. You can increase the verbosity to see more debugging
3535messages. To do so, edit your ``simulaqron_config.json `` file and change the "log_level" line from::
3636
3737 "log_level": 30,
@@ -46,21 +46,21 @@ valid values of the log level that you can use in this field.
4646
4747.. warning :: **Do not forget** to change the log level back to the default value (30) **before** submitting your solution.
4848
49- After changing the log configuration, stop your application, stop SimulaQron backend, start SimulaQron backend and then
50- start your application again.
49+ After changing the log configuration, stop your application, stop SimulaQron backend, and then start SimulaQron backend
50+ and your application again.
5151
5252
5353How can I "follow" the log files on real time?
5454----------------------------------------------
5555
56- Unix systems (Linux and macOS) embed the ``tail `` tool that allows you to follow a file as it grows. This is useful to
57- print a log file on the terminal, and keep "listening to" new updates as they are written on the file. To do so, run
56+ Unix systems (Linux and macOS) embed the ``tail `` tool that allows you to follow a text file as it grows. This is useful
57+ to print a log file on the terminal, and keep "listening to" new updates as they are written on the file. To do so, run
5858the following command on a separate terminal::
5959
6060 tail -f /my/log/file.log
6161
6262Adjust the ``/my/log/file.log `` path to match the file you want to follow on real time. This command will print on the
63- terminal the last 10 lines of the file, and the will keep waiting for new lines to arrive. As soon as they arrive, they
63+ terminal the last 10 lines of the file, and it will keep waiting for new lines to arrive. As soon as they arrive, they
6464will also be printed don the terminal.
6565
6666
@@ -73,27 +73,27 @@ This can happen for multiple reasons. We will try to address a few of them here.
7373Another instance of the backend is still running
7474^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7575
76- The most common scenario arises when you are trying to run the application layer using a backend from "another version".
77- This can happen when you update the port numbers in the ``simulaqron_networks.json `` file and you did not restart the
78- backend after that.
76+ The most common scenario arises when you are trying to run the application layer using a backend from "another version"
77+ (or even another application). This can happen when you update the port numbers in the ``simulaqron_networks.json ``
78+ file and you did not restart the backend after that.
7979
80- In this case try restarting simulaqron backend by running::
80+ In this case try restarting SimulaQron backend by running::
8181
8282 simulaqron stop
8383
84- and then running the ``simulaqron start `` command as per the example or step of the lab you are currently following.
84+ and then run the ``simulaqron start `` command as per the example or step of the lab you are currently following.
8585
86- If after this the error persist, check the code of the application (usually alice and/or bob) and make sure that these
87- file load the same ``simulaqron_settings.json `` and ``simulaqron_config.json `` files as the `` `simulaqron start ``
88- command.
86+ If after this the error persist, check the code of the application (usually alice and/or bob implementations ) and
87+ make sure that these file load the same ``simulaqron_settings.json `` and ``simulaqron_config.json `` files as the
88+ ones passed to the `` simulaqron start `` command.
8989
9090.. _exception-in-backend :
9191
9292Exceptions on the backend
9393^^^^^^^^^^^^^^^^^^^^^^^^^
9494
9595When running the backend, the spawned processes are daemonized, meaning that if an exception happens there, it is not
96- possible to see that on the terminal. When an exception happened in the backend, some of the TCP ports used to execute
96+ possible to see that on the terminal. When an exception happens in the backend, some of the TCP ports used to execute
9797quantum operations are not properly open, and your application might be waiting for a connection or message that will
9898never arrive.
9999
@@ -107,16 +107,17 @@ more clues about what is happening.
107107Protocol not implemented properly
108108^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
109109
110- Another usual scenario where your application looks stalled is because of error when implementing classical messages
110+ Another usual scenario where your application looks stalled is because of errors when implementing classical messages
111111interchange. In some cases, your client or server side application is waiting for the arrival of a message. Once it
112112arrived, it reads the characters from the classical socket, and check if it the expected message or not.
113113
114114In this case, make sure that you properly check the expected string, and raise and exception or fail the execution if
115- something unexpected happen. To this last end , you can use python asserts to aid you in that::
115+ something unexpected happen. In this last case , you can use python asserts to aid you in that::
116116
117117 assert message == "expected"
118118
119- The line above will make whole program fail if ``message `` is not exactly the string ``expected ``.
119+ The line above will make whole program fail if the variable ``message `` does not contain the exact the string
120+ ``expected ``.
120121
121122.. caution :: Killing a single process might leave some other processes (application nodes) still running in the
122123 background. This might lead to scenarios where subsequent execution might fail with connection errors. To fully
@@ -169,17 +170,17 @@ in their command line.
169170In the example above, it is important to identify some information. The ``PID `` and ``COMMAND `` columns are the most
170171important ones. We will use them to identify which processes can be terminated:
171172
172- * Processes that contain ``simulaqron start `` in their commandline , they are *SimulaQron backend-related processes *.
173+ * Processes that contain ``simulaqron start `` in their command line , they are *SimulaQron backend-related processes *.
173174* Processes that are simply ``python myTest.py `` *are usually SimulaQron application processes *. Try to remember
174175 if you manually started these processes (or via the ``run.sh `` script) to correctly identify it.
175- * All other processes on the list *are usually system processes *. **These processes need to left untouched **.
176+ * All other processes on the list *are usually system processes *. **These processes need to be left untouched **.
176177
177- Once that you have identified that you have some leftover processes from old executions, you can try two ways to stop
178- these processes:
178+ Once that you have identified the processes that you want to terminate (usually leftover processes from old executions),
179+ you can try two ways to stop these processes:
179180
180181* Run ``simulaqron reset processes ``. As explained in the :ref: `starting backend section <starting-backend >`, this
181- command can be used to forcefully stop any backend-related processes. If you run this command and run get the list
182- of python processes, you'll see that some of them are not there anymore ::
182+ command can be used to forcefully stop any backend-related processes. If you run this command and later run
183+ `` ps aux | awk 'NR==1 || /python/' `` to get the list of python processes, you'll see that some of them disappear ::
183184
184185 $ simulaqron reset processes
185186 Are you sure you want to forcefully stop all the `simulaqron` processes? [y/N]: y
@@ -212,7 +213,8 @@ these processes:
212213 root 1723 0.0 0.0 114868 23364 ? Ssl 08:15 0:00 /usr/bin/python3 /usr/share/unattended-upgrades/unattended-upgrade-shutdown --wait-for-signal
213214 user 12561 0.0 0.0 11764 2360 pts/1 S+ 11:26 0:00 awk NR==1 || /python/
214215
215- You can see that we were able to kill the leftover SimulaQron application process (``python bobTest.py ``).
216+ You can see that we were able to kill the leftover SimulaQron application process (``python bobTest.py ``), but also
217+ the processes from the SimulaQron backend.
216218
217219.. note :: When running ``kill``, if you get errors like "kill: (<PID>) - No such process", you can safely ignore them.
218220 This error means that you specified a PID that was not valid. Recheck the process list ans try again.
@@ -223,7 +225,7 @@ How can I check if a port is taken or not?
223225------------------------------------------
224226
225227First of all, a running system is dynamic, so there's no guarantee that a port available now will still be available
226- in 5 minutes more . Despite this, if you pick a port number (ranging from :math: `1 ` to :math: `65535 `) cleverly enough,
228+ in in the future . Despite this, if you pick a port number (which range from :math: `1 ` to :math: `65535 `) cleverly enough,
227229it will most likely be available whenever you need it.
228230
229231In Linux, port numbers under :math: `1000 ` need sudo permissions to be used, so we highly recommend *not * to use them.
@@ -341,13 +343,13 @@ After installing this, try creating your virtual environment again.
341343error: command 'x86_64-linux-gnu-g++' failed: No such file or directory
342344"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
343345
344- This usually happens when installing simulaqron using pip *with the optional dependencies * (i.e.
346+ This usually happens when installing SimulaQron using pip *with the optional dependencies * (i.e.
345347``pip install "simulaqron[opt]" ``), on a machine that does not have a C++ compiler. Please make sure that you install
346348all the requirements by running::
347349
348350 $ sudo apt-get install build-essential cmake vim git linux-headers-generic
349351
350- Then try to install simulaqron with the optional dependencies again.
352+ Then try to install SimulaQron with the optional dependencies again.
351353
352354
353355macOS-specific errors
@@ -357,7 +359,7 @@ macOS-specific errors
357359error: command 'x86_64-linux-gnu-g++' failed: No such file or directory
358360"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
359361
360- This usually happens when installing simulaqron using pip *with the optional dependencies * (i.e.
362+ This usually happens when installing SimulaQron using pip *with the optional dependencies * (i.e.
361363``pip install "simulaqron[opt]" ``), on a machine that does not have a C++ compiler. Please make sure that you install
362364all the requirements by running::
363365
@@ -381,13 +383,13 @@ On macOS, brew should install the development dependencies. You can always try t
381383
382384 % brew reinstall python@3.12
383385
384- After this, try installing simulaqron again.
386+ After this, try installing SimulaQron again.
385387
386388
387389'Compiler' object has no attribute 'dry_run'
388390""""""""""""""""""""""""""""""""""""""""""""
389391
390- This error arises when trying to install simulaqron with the optional dependencies. One of them is
392+ This error arises when trying to install SimulaQron with the optional dependencies. One of them is
391393`ProjectQ <https://projectq.ch/ >`_, which is a rather old software, written in C++. Considering this, ProjectQ
392394*needs to be compiled by pip * before installing it. Since ProjectQ is an old software, it relies on compilation
393395tools that nowadays are not part of the pip compilation toolchain.
@@ -399,7 +401,7 @@ not create an isolated environment for compiling ProjectQ::
399401 $ pip install "git+https://github.com/ProjectQ-Framework/ProjectQ.git@v0.8.0" --no-build-isolation
400402
401403*On macOS systems *, we have also observed this error when compiling `QuTip <http://qutip.org/ >`_. In this case, you
402- can also instruct pip to compile Qutip with the older toolchain::
404+ can also instruct pip to compile Qutip and ProjectQ with the older toolchain::
403405
404406 % pip install "setuptools<81" pybind11 Cython
405407 % pip install "git+https://github.com/ProjectQ-Framework/ProjectQ.git@v0.8.0" --no-build-isolation
@@ -414,4 +416,4 @@ can also instruct pip to compile Qutip with the older toolchain::
414416 **In macOS, these packages are compiled only for macOS 26 (Tahoe) **. Additionally, they require installing "libomp"
415417 from homebrew: ``brew install libomp ``.
416418
417- Then you can try to install simulaqron with optional dependencies again.
419+ Then you can try to install SimulaQron with optional dependencies again.
0 commit comments