Comments (7)
Can you show how you initialize the communication stack?
It's weird, according to your log, the isotp layer starts transmitting over 1 sec after send() is called.
from python-udsoncan.
Thank you for your reply!
My device is the ZLGCan,I turn on the Can device and start the receiving thread.
if self.cmbUDSEnable.get() == 'YES':
self.udsclient.open()
self._terminated = False
After send() is called ,The msg has been put into the queue.
···
log info:send msg queue put
···
But rxthread_task seems to be blocked.
main thread TIMEOUT,rxthread_task start calling isotp_send().
toIsoTPQueue queue size is now 0
Sending xxxx
Receiving:xxx
fromIsoTPQueue queue size is now 1
something wrong with threading?
from python-udsoncan.
I suspect your zcan lib to takes ownership of the GIL and not release it. Preventing any thread to work during that time.
Can you make an experiment for me?
make a simple thread that prints to the console in a loop. And try calling your zcan function, See if it stops the thread.
import threading
import time
stop_event = threading.Event()
def func:
while not stop_event.is_set():
print("%s Thread: Still running" % time.time())
time.sleep(0.1)
def main():
t = threading.thread(target=func)
t.start()
time.sleep(0.5)
try:
printf("%s Main thread: Sending a zcan message" % time.time())
zcan.Transmit(...)
printf("%s Main thread: Sending a zcan message" % time.time())
#... Test each function. Then see if the thread ever stops for a long time.
finally:
stop_event.set()
t.join()
from python-udsoncan.
zcan lib
I found out why the problem happened.
I want to output log to textbox.
self.logger = logging.getLogger('logger')
# self.logger.setLevel(logging.DEBUG)
udsLogHandler = TextboxHandler(self.text_log)
self.logger.addHandler(udsLogHandler)
# self.isotp_layer.logger.setLevel(logging.DEBUG)
# isotpLogHandler = TextboxHandler(self.text_log)
# self.isotp_layer.logger.addHandler(isotpLogHandler)
# self.udsclient.conn.logger.setLevel(logging.DEBUG)
# connLogHandler = TextboxHandler(self.text_log)
# self.udsclient.conn.logger.addHandler(connLogHandler)
self.udsclient.logger.setLevel(logging.DEBUG)
clientLogHandler = TextboxHandler(self.text_log)
self.udsclient.logger.addHandler(clientLogHandler)
If I uncomment isotp_layer.logger,problems are going to happen.
Thanks again for your reply!
from python-udsoncan.
Ohh, you are using a UI framework and it's the UI that takes ownership of the GIL.
You may want to consider running the isotp communication in a different process and use IPC mechanism to itnerract with the GUI
cheers
from python-udsoncan.
guilog.txt
pycharmlog.txt
CANdevicelog.asc.txt
Hi!After updating udsoncan to 1.21.2 and isotp to 2.0.3, I am now using PythonIsoTpV2Connection, but the Timeout is triggered again.Now I'm using a separate thread to log to ScrolledText.
In older versions, self.udsclient.logger was set to DEBUG and the flush was successful, but it was set to INFO and a Timeout occurred.
I even removed the srrollText to stop logging.But Timeout is still triggered.
Would you like to check the logs and see what you can find?Looking forward to your reply!
from python-udsoncan.
If I remember correctly, your GUI framework seemed to take ownership of the GIL. That blocks every threads.
If you configure your GUI to not do that, it would be ideal. Otherwise, maybe the cleanest way is to put the transmission part into a different process and make the GUI commnunicate through IPC.
from python-udsoncan.
Related Issues (20)
- Allow requesting a did without decoding it HOT 11
- Unexpected UDS Authentication message byte order(Subfunction 0x05,0x6) HOT 12
- IsoTPSocketConnection can not be closed with tpsock in blocking mode HOT 5
- struct.error on change_session interpret_response HOT 9
- IsoTPSocketConnection doesn't work with can-isotp versions 2 and up HOT 9
- Performance tests HOT 16
- When using CAN as a diagnostic channel,other application messages are sent periodically on the bus, calling the client.change_session interface will block at the self.conn.empty_rxqueue() interface. HOT 3
- cannot import name 'Literal' from 'typing' (/usr/lib/python3.7/typing.py) HOT 8
- Act as server and parse python-can messages HOT 6
- No data received: [TimeoutException] Problem HOT 12
- ReadDataByIdentifier: no codec.encode() ? HOT 6
- Security access SAPR response not correctly interpreted HOT 3
- WriteDataByIdentifier service execution returned a negative response IncorrectMessageLengthOrInvalidFormat (0x13) when data length is correct HOT 4
- Adding parameter to Communication Control Service(0x28) HOT 10
- SecurityAccess mishandes a level value of 0 HOT 3
- SocketConnection cannot be closed HOT 6
- P2 timer issue on client.transfer_data(block_number, data HOT 22
- Runtime Error: Connection is not open HOT 2
- TimeoutError: timed out HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-udsoncan.