-
Notifications
You must be signed in to change notification settings - Fork 72
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
Messages failing after disconnect #33
Comments
Kudo's on the amount of information you provided in this report. How are you running your simulator, do you have a piece of hardware? |
Thanks, there is definitely a bug with instances of the buffers and the listeners that get attached. A work around I found is to just to completely reinstantiate your library after every disconnect
as well as reinstantiating the btSerial object after every disconnect.
It's a pretty nuclear workaround but it is good enough for now. However I feel that the risk of a memory leak here is enormous. I'm fairly sure there are listeners still attached to the buffers somewhere. So although we "overwrite" the previous instance of your lib. Garbage collection will likely not dispose of it. However, I'll either have to monitor resource usage of my app over an extended period or refresh myself on the specifics of Garbage Collection to be sure this is the case. I don't yet know if the listeners/callbacks are considered the javascript equivalent of strong or weak reference. |
Yes, I can agree that several parts are very far from optimal. Maybe I should write my mock, to mock the bluetooth + obd so I can work on this on my local computer without all the bluetooth hassle. |
Hi,
I am creating a graphing app based off your library. The first time I connect to a device it works perfectly (Other than I had to remove the "replies" part of the string that gets added to the Queue. It seems like it always appends a 1 to every PID which would just make my ELM Simulator return nothing. Removing this makes it work.
However back to the issue, once I disconnect and reconnect it seems there are really weird concatenated messages being sent to the BT device.
Seems like something weird goes on after a disconnect that doesn't properly clean up. I have a hunch it is something to do with the intervalWriter which may go deeper into the way the btSerial lib is handling the buffers. But am struggling to debug that. I've tried just adding all the functions I could find that detach listeners, detach pollers, clear queue,etc..etc. None of it helped. If you disconnect again and reconnect the problem only compounds. See my 3rd screenshot.
Screenshot of Good Calls on first connect on OBD Device
Screenshot of Data receieved back in front end from OBD Device
Screenshot of calls being sent after disconnect and reconnect.
Screenshot of Data receieved back in front end from OBD Device after disconnect and reconnect.
After second disconnect and reconnect
You can find my project here which should demonstrate the issue.
https://github.com/Reiss-Cashmore/obdii-grapher
I am using Mac OSX if that helps.
The text was updated successfully, but these errors were encountered: