-
-
Notifications
You must be signed in to change notification settings - Fork 82
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
No connection via virtual environement #93
Comments
Where is the server? A different process? Somebody once told me: "Problems are like bananas, they come in bunch". That's the 3rd report of problem with So far, these 2 issues reported similar problems and most plausible cause is a known race condition in the kernel.
I will look more in details regarding this, but for now, any additional info you can provide will be helpful. For instance,
|
Well. Sorry for small amount of info :)
|
I started upgrade up to Ubuntu 23.04. Lets see... |
Are you saying that you were running similar code on a raspberry pi and it worked? |
Exactly. On 3-4 devices: Pi3, Pi4, PiZero... |
@lumagi: Thoughts? |
Well. After upgrading of Ubuntu... nothing was changed :D
|
Judging from the stack trace and the code, it's likely that this is also the race condition I mentioned in the other two threads. I guess anyone that's using your UDS client with a kernel ISO-TP socket could potentially be affected. The problem is that the error message is really counter intuitive. The time out happens because the send and receive side of the IsoTPSocketConnection are fighting and only one can win. The other one times out. So it's not really a time out issue on the bus but inside the kernel. The patch with the fix is being applied to the stable kernel versions as well. That means that most or all affected Linux distributions should also pick up the patch eventually. Since the issue only occurs with the kernel socket, the simplest way to verify if it's really the kernel race condition is to replace IsoTPSocketConnection with the Python implementation. If the problem goes away, it was likely the aforementioned bug. |
It is really horrible to see the effect of the backported patch that finally ADDED a regression. |
Thank you :) I upgraded... but this is insane, because it works before upgrading :D This solve in my case to add virtual can: But still doesnt works at all. No data ;( Seems like still old kernel |
If you check out that kernel at the Ubuntu site: https://launchpad.net/ubuntu/+source/linux-gcp/6.2.0-1017.19 The changes were summarized at Thu, 05 Oct 2023 21:59:43 -0500 Contains "can: isotp: isotp_ops: fix poll() to not report false EPOLLOUT events" - but not the fix for it! So you still have to wait for the fix to show up in stable kernels or you install a 6.6-rc6 kernel which definitely contains the fix. But even https://kernel.ubuntu.com/mainline/v6.6-rc6/ does not exist at time of writing this post (only v6.6-rc5). |
@hartkopp Do you think there could be a way to detect the existence of the bug at runtime so a warning can be issued? |
I made more experiments :) fresh install of Ubuntu 22.04 server. And fresh pip3 modules and the last version of python3 I have my working script on Raspberry Pi. But when I run client.change_session(2) on VM with Virtual CAN, I got this one error after some client.read_data_by_identifier (2 or 3 times I read some data from UDS server):
here is candump:
|
I have no idea. The problem only shows up in Phython environments so far. Currently the fixes are available in Linux 6.6, and 6.5.8+ and 6.1.59+ |
Hi @pompushko , I created an out-of-tree isotp driver in a special branch "mainline-5.4+" https://github.com/hartkopp/can-isotp/tree/mainline-5.4+ If you pull this repo and switch to the "mainline-5.4+" branch you should be able to build a can-isotp.ko module on your current system which covers all the latest fixes. Once the module is build (just type |
Yes. All works as expected :D
|
But I start facing another one issue during request_transfer_exit()
This is physical interface for cangw:
This is virtual interface:
I'm not sure if that issue is a python-can or iso-tp...
UPD: problem in my UDS server |
Shall we close that issue then? |
Definitely :D |
Just to finish this up: The problem has been introduced into the mainline kernel with this patch (2023-04-05) And it has been fixed with this patch (2023-10-06) Both patches have been backported to the Linux Longterm stable kernels. These stable kernels do only contain the first fix but not the second fix and are therefore broken regarding this python-can issue: So updating your system to the latest stable kernels (5.10.200+, 5.15.138+, 6.1.59+, 6.5.8+) will fix it. |
Hello, I have virtual server and virtual vcan0 interface. And this code:
When I try to run my application, I got [TimeoutError] : timed out error.
Even in candump vcan0 no data.
But! When I try cansend vcan0 01a#11223344AABBCCDD, I see data:
Thank you!
The text was updated successfully, but these errors were encountered: