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

[Humble, simple-api-server] Websockets 9.1 from ubuntu offical ppa doesn't seem to work #169

Open
Briancbn opened this issue Nov 16, 2022 · 9 comments
Labels
bug Something isn't working

Comments

@Briancbn
Copy link

Bug report

When launching office world, the simple API server is not able to update the task states from the websocket server, resulting in the js-panel not able to display the tasks states. (the #166 (comment) by Grey prompt us to investigate the version difference, although the fastapi is not giving us any issue at this point)

We switched to using the latest version (10.4), through building from source. It seems to work.

It seems that the default Ubuntu PPA's python3-websockets version 9.1-1 is somehow buggy.

@Briancbn Briancbn added the bug Something isn't working label Nov 16, 2022
@Yadunund
Copy link
Member

The issue has already been documented. Our Installation README further highlights this problem as a Note. There is also a PR open to update the README open-rmf/rmf#270.

If you feel something is still ambiguous and needs to be added to the README, please open a PR and we'll be happy to merge it in. Closing this ticket as it is not a bug. A solution is available and documented.

@Briancbn
Copy link
Author

Briancbn commented Nov 16, 2022

@Yadunund This is not fastapi package tho, it's websockets, I am not sure if updating the fastapi will upgrade the websockets package too.

@Briancbn
Copy link
Author

Briancbn commented Nov 16, 2022

@Yadunund I can confirm that installing fastapi through pip will not upgrade websockets automatically, if there is already a installation of websockets through sudo apt install python3-websockets. Need to include python3 -m pip install websockets command in the setup instructions.

@Yadunund
Copy link
Member

Yadunund commented Nov 16, 2022

@Briancbn I see. I assumed websockets would get installed when installing the other dependencies via pip.
What if websockets system pkg is not installed when installing the other pip dependencies? Would it get installed then? If that's the case, we can update the readme to highlight that both fastapi and websockets pkgs should not be installed as ubuntu system packages prior to building the demos pkgs.

@Briancbn
Copy link
Author

Briancbn commented Nov 16, 2022

@Yadunund websockets doesn't get installed with this command in pip
https://github.com/open-rmf/rmf/blob/339a567d88cdc55e5cb21dec82a8ad052a5f72ec/README.md?plain=1#L72

python3 -m pip install flask-socketio fastapi uvicorn datamodel_code_generator

@Yadunund
Copy link
Member

Sorry I wasn't being clear and it didn't help that I mixed up fastapi and websockets pkgs. Kindly ignore my previous comments.
I left a comment in your PR here that better summarises what I had in mind
https://github.com/open-rmf/rmf/pull/272/files#r1023761256

I can confirm that websockets-9.1 has some issues and the rmf_demos_panel does not setup the websocket server correctly but updating to websockets-10.4 via pip fixes the problem.

@ncnynl
Copy link

ncnynl commented Nov 30, 2022

i have the issue too .

I have installed the humble version of rmf to ubuntu22.04

I follow the desc purge websockets 9.1 and Install websockets to 10.4 , but still not show task status on rmf_pane_js website

I startup office.launch.xml , it will show the content:

[simple_api_server-14] The WebSocket transport is not available, you must install a WebSocket server that is compatible with your async mode to enable it. See the documentation for details. (further occurrences of this error will be logged with level INFO)

@ncnynl
Copy link

ncnynl commented Nov 30, 2022

I have fixed the issue.

follow steps:

sudo apt remove python3-websockets 
python3 -m pip install websockets==10.4
python3 -m pip install asyncio 

and recompile repo .

cd ~/rmf_ws
source /opt/ros/humble/setup.bash
export CXX=clang++
export CC=clang
colcon build --mixin release lld

it work now.

@rananat
Copy link

rananat commented Aug 13, 2023

In our case, we got this issue TypeError: Server.emit().. first. It is resolved by downgrading the version of python-socketio to 5.7.2.

Then we got the message "The WebSocket transport is not available, you must install a WebSocket server that is compatible with your async mode to enable it.", and the RMF Panel front end could not connect to web socket.

The above steps did not solve the issue.

After downgrading the version of python-socketio further to 5.0.3, we still got the message "The WebSocket transport is not available..", but the RMF Panel front end could receive messages through the web socket.

python3 -m pip install python-socketio==5.03

In addition, when we run open-rmf inside a container, we get the error "cannot bind address.." at line observer.spin(done_fut) in simple_api_server.py.

Changing the server_url in the following code from localhost to 127.0.0.1 solves the issue.

observer = AsyncRmfMsgObserver(
      msg_callback,
      msg_filters={RmfMsgType.TaskState: []},
      server_url="127.0.01", #Change localhost to 127.0.0.1
      server_port=int(port_num)
  ) 

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

4 participants