pylessard / python-udsoncan

Python implementation of UDS (ISO-14229) standard.
MIT License
588 stars 203 forks source link

Fix J2534: ERR_CONCURRENT_API_CALL with using Pulsar #250

Closed kirya-dev closed 1 day ago

kirya-dev commented 3 days ago

ERR_CONCURRENT_API_CALL

Im added log_last_operation after PassThruWriteMsgs and this fix show me which real reason didnt work Pulsar correctly.

I temporarily fix this problem by adding before reading - time.sleep(0.02). Doesn't seem to be a good idea.

kirya-dev commented 3 days ago

Will test Semaphore tomorrow with Pulsar..

kirya-dev commented 3 days ago

Hmm.. I think this should be around in queries with all Connection classes.

Why reading is async from main thread? I think reading thread must be started when we want.

  1. Acquire Semaphore.
  2. Clerar rx buffer
  3. Send WriteMsgs
  4. Sending ReadMsgs during current timeout
  5. Release Semaphore.

Its steps creating queue of all queries. In one time handling one request-response.

kirya-dev commented 2 days ago

test

Works perfectly ✨

pylessard commented 2 days ago

Is this a work in progress or ready to be merged?

kirya-dev commented 2 days ago

I think ready for merge.

i can improve this for all connections. Maybe its a newer version 2.x will be?

But i can test only j2534

pylessard commented 2 days ago

No, don't touch other connections please. They are thread safe