-
Notifications
You must be signed in to change notification settings - Fork 2
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
Simulator hangs on startup when existing device file is present #6
Comments
Hi, I can't seem to reproduce your problem - when I try this is what I get: In first terminal:
In second terminal:
Which is as expected - you can't have two simulators running at the same time because they both bind to the same address:port. Am I missing something? BTW, Docker may be an easier way to achieve what I think you're trying to do - there's an example here. |
Oh, d'oh! I didn't copy the second command correctly, it's not supposed to be the same as the first. Fixed above, sorry about that! That said, I just attempted to reproduce this again, and it's started working correctly, at least when I run the commands directly from terminal. Let me do a little more digging and see if I can figure out what triggers this. |
Ah, ok - was able to replicate this with your configuration and scripts from Possible issue with time profiles. Just to confirm - these are the steps I followed:
Let me dig into that.. |
Yup, that looks right. I think it may be an issue with either card swipe events, or events in general, being written to/read from the file. Removing lines from |
Yup, it's an actual bug - somehow the JSON device file is getting serialized with an event list that looks like this:
which triggers another bug in the deserialisation where it attempts to truncate the event list to the correct size:
It can be reproduced with just one instance of the simulator and the test-cli.sh script. |
The Hopefully that should sort out your immediate problem - I still need to take a look at the logic behind the infinite loop (it's been a while) and in general make this more robust. |
Yup, that fixed it. The simulator now fully loads when a previous device file is loaded. |
Reworked EventsList unmarshalling from JSON - Added check for zero chunk size in EventsList::UnmarshalJSON - Replaced zero values for EventList size and chunk with defaults - Reworked truncation to use calculated offset rather than loop
Ok, root cause was that the events list was not initialised in the simulator default constructor, which is how it ended up with:
Have fixed that and also:
Think that fixes this in a way that I'm happy with - will leave this open for another day or two in case anything related crops up. |
Closing this as fixed - feel free to reopen if you need to :-) |
As mentioned in #5.
Issue
When running
uhppote-simulator
, the simulator hangs when attempting to load config files from a previous run. Neither the REST API or any simulated controllers can be contacted.Issue encountered on Linux x86_64 (PopOS/Ubuntu 22.04 LTS).
Steps to Reproduce
In a terminal window, run the following to start a
uhppote-simulator
instance.In another terminal window, run the following to generate a controller config. (EDIT: Fixed duplicate command)
In the first terminal window, stop and rerun the
uhppote-simulator
command. It will hang similar to the following. Themake
targets were setup to make testing easier:simulator
checks for and removes a config file prior to running the simulator, whilesim
does not, just attempts to run the simulator.As you can see, something prevents the simulator from reaching the point of binding to the
--bind
address.Thank you in advance for your assistance!
The text was updated successfully, but these errors were encountered: