-
Notifications
You must be signed in to change notification settings - Fork 25
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
--interactive switch unexpectedly affects dispatching #71
Comments
The problem is now clear. The server is started from In the A solution is to call
I don't really see anything else. Using command line options ( One option might be :- initialization(Goal, main). or something like that. There is already initialization/2, so -although non-standard- it is not a big step. The |
Thank you for looking into this! I would like to add the reason why I care about the order of files in this case: In the case of Proloxy, there are directives in Of course, Still, it is natural in such cases to specify So, for this reason, I would like to endorse a way to state "run this predicate after all files have been loaded". For example, what about: :- main Goal. If the |
I'm don't know what ISO says about this. AFAIK though most systems demand the directive to be present in each file (before the clauses). SWI-Prolog is indeed more relaxed and only requires the declaration once before clauses from a second file are loaded. |
With Kuniaki also falling into this trap I agree we need something. I'm not yet sure what though. An option would be to keep This needs some thought ... |
In fact, I would regard this as an advantage in this concrete case. The reason I found this issue altogether was that I spawned a new thread upon initialization of my I was surprised to see Now, I have reversed the files again, but of course I have a (comparatively harmless) race condition where the watcher may report the number of threads before the Unix daemon has created all of them. So, in fact, it would be great for me in this case if I could say:
and It's true, there may be a few milliseconds where the daemon listens but the dispatching rules are not yet defined, but then again this may anyhow be the case. I'm not saying that this behaviour is particularly desirable in all other cases too, but in the case of the Unix daemon it would make perfect sense to me, and registering an alternative toplevel sounds like a very clean solution. |
I am filing this as an HTTP issue because this is where I have found a case that is easy to reproduce, and it is also where this issue affects me most. This may of course be due to a more general underlying issue with file loading.
To reproduce, please download Proloxy, and make sure to run any (arbitrary) web server on port
3031
, because that's the port used in theconfig.pl
example configuration of Proloxy.Then, please run:
And test the dispatch with:
This will indirectly (via Proloxy) fetch
/
from the web server on port 3031, and works completely as expected.In contrast, if you omit the
--interactive
switch and use--no-fork
instead, the proxy server again starts exactly as expected:But we now get:
If you
telnet
to Proloxy or access it differently, you see the exact reason:This error stems from Proloxy, apparently because the file
config.pl
that appears on the command line was not loaded in the same way as if we had used--interactive
.Note that if I turn around the file arguments, i.e.:
Then everything works as expected again. Intuitively, I would like the same outcome in all of these cases, like in the case of the
--interactive
switch. In particular, loading the config file before or afterproloxy.pl
should ideally not make any difference, at least not in such simple cases.The text was updated successfully, but these errors were encountered: