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

ROS service exit with timeout #184

Open
michaelblindnology opened this issue Jul 21, 2021 · 4 comments
Open

ROS service exit with timeout #184

michaelblindnology opened this issue Jul 21, 2021 · 4 comments

Comments

@michaelblindnology
Copy link

Hi,
I'm using ROS1 melodic, branch gopher-devel.
I'm using rostful for ROS service.
My service takes 2-3 seconds.
The ROS service returns successfully, but rostful returns with 500.

An exception occurred! => 500 
{'traceback': {'tb_frame': {'f_code': {'co_name': 'post', 'co_filename': 'rostful/api_0_1/flask_views.py'}, 'f_globals': {'__name__': 'rostful.api_0_1.flask_views', '__file__': 'rostful/api_0_1/flask_views.pyc'}}, 'tb_next': None, 'tb_lineno': 355}, 'exc_type': "<type 'exceptions.NameError'>", 'exc_value': "global name 'PyrosServiceTimeout' is not defined"}
ERROR:rostful:An exception occurred! => 500 
{'traceback': {'tb_frame': {'f_code': {'co_name': 'post', 'co_filename': 'rostful/api_0_1/flask_views.py'}, 'f_globals': {'__name__': 'rostful.api_0_1.flask_views', '__file__': 'rostful/api_0_1/flask_views.pyc'}}, 'tb_next': None, 'tb_lineno': 355}, 'exc_type': "<type 'exceptions.NameError'>", 'exc_value': "global name 'PyrosServiceTimeout' is not defined"}

If I not call my service, but return true, everything is working.
Could please assist,

Thanks Michael

@asmodehn
Copy link
Member

Hi,

I had a quick look and tried to jog my memory... hopefully this will give you some clues.

Looking at the code I guessing you made a call here: https://github.com/pyros-dev/rostful/blob/gopher-devel/rostful/api_0_1/flask_views.py#L314
Then accessing that part of the code : https://github.com/pyros-dev/rostful/blob/gopher-devel/rostful/api_0_1/flask_views.py#L351 your interpreter seem to not know the PyrosServiceTimeout global name.
This one is dynamically imported here : https://github.com/pyros-dev/rostful/blob/gopher-devel/rostful/api_0_1/flask_views.py#L107
Not sure why it would not be defined, but it doesn't hurt to review your virtualenvironment setup, how your run your interpreter, etc.

In any case, attach a debugger to your server, put some breakpoints, and you will be able to track what exactly happens.

It is possible this behaviour is triggered by some untested code path underneath, but the error itself only says the symbol is not defined... so it is the first thing to investigate.

@asmodehn
Copy link
Member

I noticed also there is a pull request impacting that part of the code for gopher-devel : https://github.com/pyros-dev/rostful/pull/108/files You should probably try it out.

Let me know if that works for you, I ll merge it.

@michaelblindnology
Copy link
Author

Hi,
My service respond took > 5 seconds, so I exit on timeout.
I changed /home/ubuntu/.local/lib/python2.7/site-packages/pyzmp/service.py#90
in function def call(self, args=None, kwargs=None, node=None, send_timeout=10000, recv_timeout=20000, zmq_ctx=None):
recv_timeout from 5000 to 2000.It fixed the problem.
How can I change recv_timeout from flack_views ?
Is it possible to run my ROS services in diffent flask threads/process ?
E.g make_plan of move_base in thread1, other service in thread 2 ?
THanks in advance,

@asmodehn
Copy link
Member

asmodehn commented Jul 25, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants