-
Notifications
You must be signed in to change notification settings - Fork 14
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
Segmentation Fault when adding an empty list of vehicles #118
Comments
I agree that isn't ideal. @jcoupey, I assume that throwing an exception if there are no vehicles is best added upstream vroom. If not, I can easily add on in the Python layer alone. |
Thanks for reporting. problem_instance.add_job(job)
problem_instance.add_vehicle([]) Looks like you're assigning an empty array as a vehicle, which is different than having an empty list of vehicles. Anyway it turns out that both situations are handled upstream when using json input: $ vroom '{"vehicles":[],"jobs":[{"id":1,"location_index":1}],"matrices":{"car":{"durations":[[0,100],[100,0]]}}}'
[Error] Invalid vehicles.
{"code":2,"error":"Invalid vehicles."}
$ vroom '{"vehicles":[[]],"jobs":[{"id":1,"location_index":1}],"matrices":{"car":{"durations":[[0,100],[100,0]]}}}'
[Error] Invalid vehicle.
{"code":2,"error":"Invalid vehicle."} but not when using the C++ API. I opened VROOM-Project/vroom#1187 upstream to track this. |
Fixed in VROOM-Project/vroom#1190. |
I am looking at updating pyvroom now, but see that there are a few other updates upstream as well that also needs to be accommodated for. I will get to it when I have time. My schedule is quite filled these days, so please be patient. |
Of course. Thank you for your work and you transparency. |
Hello,
When setting an empty list of vehicles pyvroom the python process crashes with a Segmentation Fault.
Setting an empty list of vehicles for the problem instance is obviously not what anyone would intend to do and is something that one might want to detect early in its logic, but it may be inviable to anticipate what other scenarios end up triggering a segfault.
Nevertheless, a segmentation fault in the python process itself is something that code making use of pyvroom can not defent itself against or recover from, is fairly unexpected and is something that makes detecting and debugging the actual issue much harder.
It would be a great improvement even just throwing a generic RuntimeError.
Here is a minimal code reproducing the segfault with pyvroom version 1.14.0 on Ubuntu (kernel 6.5.0) aarch64:
Thank you very much for your work
The text was updated successfully, but these errors were encountered: