Closed gustavogalvan closed 1 year ago
Hey @gustavogalvan, thanks a lot for reporting. So, do you have some steps for how to reproduce the problem?
Yes! Use the provided example in Examples/Console/FPC/urlrouter.lpr and add Threaded:=true; in main section:
begin
with TServer.Create(nil) do
try
Port:=8080;
Threaded:=true;
Open;
if not Active then
Exit;
WriteLn('Server running at http://localhost:', Port);
ReadLn;
finally
Free;
end;
end.
Build and run, and test if work fine in declared routes (like http://127.0.0.1:8080/home). Then try access to / (http://127.0.0.1:8080/) several times and you can see the lock. The same if you try access to a non existent path, like http://127.0.0.1:8080/non-existing-path
This happens in threaded mode and thread-pool.
Hi, I forgot mention I work in linux.
testing again, with curl :
gustavo@MOV:~$ curl -w '\n' http://127.0.0.1:8888/non-existing-page Page not found gustavo@MOV:~$ curl -w '\n' http://127.0.0.1:8888/non-existing-page ^C gustavo@MOV:~$ curl -w '\n' http://127.0.0.1:8888/non-existing-page ^C gustavo@MOV:~$ curl -w '\n' http://127.0.0.1:8888/non-existing-page ^C gustavo@MOV:~$
At the first request is ok, then remains locked.
I followed your code to find the unlocks for that situations and not found. Just two unlocks
Hey @gustavogalvan, could you provide a Pull Request? If so, we can approve it and merge into master.
Hello Silvio, I just made the pull request. I am sorry for the delay.
El mié, 12 abr 2023 a las 14:12, Silvio Clécio @.***>) escribió:
Hey @gustavogalvan https://github.com/gustavogalvan, could you provide a Pull Request? If so, we can approve it and merge into master.
— Reply to this email directly, view it on GitHub https://github.com/risoflora/brookframework/issues/47#issuecomment-1505632362, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADCBR4INREQ6GVPCJH6JXPDXA3PAXANCNFSM6AAAAAAVVFUPCM . You are receiving this because you were mentioned.Message ID: @.***>
Merged. Thanks a lot for the fix! 🙂
Maybe I found the problem in BrookURLRouter.pas, in procedure TBrookURLRouter.Route. I put two FLocker.Unlock, one in line 102 after R.HandleRequest(..., and the other at the end, before DoNotFound(...
This is the code fragment:
I hope this help. Thank for your great job !