SWI-Prolog / packages-pengines

Pengines: Prolog engines
12 stars 13 forks source link

Remote pengines are not properly destroyed if having multiple remote pengines? #23

Closed xpxaxsxi closed 8 years ago

xpxaxsxi commented 8 years ago

The update_remote_destroy/1 does not destroy the pengine that is referenced in the Event-argument. This results in odd behaviour of "pengine does not exist"-exceptions, because sometimes a wrong pengine gets destroyed, because currently the first pengine that is found from database gets destroyed.

Code below has two pengine_create/1's. When the first finishes it's query before the second, it destroys the second because the pengines are asserted with asserta pengine_create([server('http://localhost:4000')]),pengine_create([server('http://localhost:5000')]),pengine_event_loop(pengine_stuff:eventx,[]).

Current code. It should be changed so that it gets the Id-term from the Event-term. update_remote_destroy(Event) :- pengine_remote(Id, _Server), destroy_event(Event), !, pengine_unregister_remote(Id). update_remote_destroy(_).

And the current test_pengines.pl has code where both pengines finish at the same time, because both pengines have exactly the same predicates, so none of them finish earlier than the other

JanWielemaker commented 8 years ago

Thanks. Should be fixed with 5a191841e15e57a208dbbd9d5b296aa35a24e2be