Closed nbusser closed 3 years ago
I talked of the problem with my college, and he informed me about the existence of use_server_timing
configuration option.
The proper way to take control of the timeout is to put the following line of code:
client.set_config('use_server_timing', False)
At the end of the day, the problem I reported is not a problem... It works as intended ! I just missed the if statement (yes, it was right under my nose 😅): https://github.com/pylessard/python-udsoncan/blob/af06bfe59693ba87e4667c8b766fc288595ddce5/udsoncan/client.py#L199
I think it would be worthwhile to make a clear documentation about timeout system. It's unclear unless you dive directly in the code.
Hi Nicolas, Yes indeed, this behaviour has been introduced in the latest UDS standard. Changing the parameter was the right thing to do in your situation.
I agree that timeout handling is a bit painful. In my defense, the standard makes it painful as well :) I will update the documentation following your recommendation.
Regards
@nbusser 请问如何让脚本可以在10服务4秒后发生3E服务,另外3E 80 为什么设置了不能发生
@jxwdgd5201314 对不起,因为我很久以前写的帖子,所以我不记住。我不再在汽车行业工作。
因為服務器要求客戶端無法遵守的緊迫時間。 許多中國用戶報告他們的 ECU 請求 50 毫秒超時,這對於用戶空間實現來說有點太緊了。
Hi,
I faced a problem concerning timeouts and
DiagnosticSessionControl
service. Once achange_session()
is made by a client, the user loses control of the timeout value.Explanation of the problem
Nominal case
Let's take a basic example: here is a functional program, with exaggerated timeout values. This program simply sends two tester present requests.
This program works perfectly when executed.
Here is the associated dump:
Problematic case
If I add a
DiagnosticSessionControl
between the two tester presents:I receive a timeout error:
We can see here that the p2 timeout value have been somehow modified to 0.030
Here is the associated dump:
Source of the problem
I checked udsoncan code and I now understand what's happening:
DiagnosisSessionControl
service performs its request through the functionsend_request()
: https://github.com/pylessard/python-udsoncan/blob/af06bfe59693ba87e4667c8b766fc288595ddce5/udsoncan/client.py#L189interpret_response()
is called, and then, some data related to p2 are assigned to the service_data of response object. https://github.com/pylessard/python-udsoncan/blob/af06bfe59693ba87e4667c8b766fc288595ddce5/udsoncan/services/DiagnosticSessionControl.py#L63TesterPresent
), runs the functionsend_request()
again, with thetimeout
parameter set to the default value, -1.session_timing['p2_server_max']
is set (here to a tiny value of 0.03). So,p2
takes the value ofsession_timing['p2_server_max']
. https://github.com/pylessard/python-udsoncan/blob/af06bfe59693ba87e4667c8b766fc288595ddce5/udsoncan/client.py#L1605 This value, since it is largely smaller thanoverall_timeout
, is defined as the reference timeout value.At the end of the day,
DiagnosisSessionControl
totally took control of the timeout value.Working around the problem
If someone else is bothered by this problem, and waiting for a fix, it can work around the problem as follows: It has to directly send the request via function
send_request()
.Using this method, we skip
interpret_response()
function and new metrics assignments