planety / prologue

Powerful and flexible web framework written in Nim
https://planety.github.io/prologue
Apache License 2.0
1.25k stars 47 forks source link

Exception message: Operation performed on a socket which has not been registered with the dispatcher yet #152

Open vanyle opened 2 years ago

vanyle commented 2 years ago

When serving static files, I get the following error.

  #[                                                                                                    
    C:\Users\vanyle\.nimble\pkgs\prologue-0.5.2\prologue\core\application.nim(535)    run               
    C:\Users\vanyle\.nimble\pkgs\prologue-0.5.2\prologue\core\application.nim(530)    run               
    C:\Users\vanyle\.nimble\pkgs\prologue-0.5.2\prologue\core\naive\server.nim(30)    serve             
    C:\Users\vanyle\.choosenim\toolchains\nim-1.6.0\lib\pure\asyncdispatch.nim(1961)  waitFor           
    C:\Users\vanyle\.choosenim\toolchains\nim-1.6.0\lib\pure\asyncdispatch.nim(1653)  poll              
    C:\Users\vanyle\.choosenim\toolchains\nim-1.6.0\lib\pure\asyncdispatch.nim(419)   runOnce           
    C:\Users\vanyle\.choosenim\toolchains\nim-1.6.0\lib\pure\asyncdispatch.nim(234)   processPendingCallbacks                                                                                                   
    C:\Users\vanyle\.choosenim\toolchains\nim-1.6.0\lib\pure\asyncmacro.nim(28)       anonymousNimAsyncContinue                                                                                                 
    C:\Users\vanyle\.choosenim\toolchains\nim-1.6.0\lib\pure\asyncmacro.nim(131)      anonymousIter     
    C:\Users\vanyle\.choosenim\toolchains\nim-1.6.0\lib\pure\asyncfutures.nim(389)    read              
  ]#                                                                                                    
  #[                                                                                                    
    C:\Users\vanyle\.nimble\pkgs\prologue-0.5.2\prologue\core\application.nim(535)    run               
    C:\Users\vanyle\.nimble\pkgs\prologue-0.5.2\prologue\core\application.nim(530)    run               
    C:\Users\vanyle\.nimble\pkgs\prologue-0.5.2\prologue\core\naive\server.nim(30)    serve             
    C:\Users\vanyle\.choosenim\toolchains\nim-1.6.0\lib\pure\asyncdispatch.nim(1961)  waitFor           
    C:\Users\vanyle\.choosenim\toolchains\nim-1.6.0\lib\pure\asyncdispatch.nim(1653)  poll              
    C:\Users\vanyle\.choosenim\toolchains\nim-1.6.0\lib\pure\asyncdispatch.nim(419)   runOnce           
    C:\Users\vanyle\.choosenim\toolchains\nim-1.6.0\lib\pure\asyncdispatch.nim(234)   processPendingCallbacks                                                                                                   
    C:\Users\vanyle\.choosenim\toolchains\nim-1.6.0\lib\pure\asyncmacro.nim(28)       switchNimAsyncContinue                                                                                                    
    C:\Users\vanyle\.choosenim\toolchains\nim-1.6.0\lib\pure\asyncmacro.nim(131)      switchIter        
    C:\Users\vanyle\.choosenim\toolchains\nim-1.6.0\lib\pure\asyncfutures.nim(389)    read              
  ]#                                                                                                    
  #[                                                                                                             
    C:\Users\vanyle\.nimble\pkgs\prologue-0.5.2\prologue\core\application.nim(535)    run               
    C:\Users\vanyle\.nimble\pkgs\prologue-0.5.2\prologue\core\application.nim(530)    run               
    C:\Users\vanyle\.nimble\pkgs\prologue-0.5.2\prologue\core\naive\server.nim(30)    serve             
    C:\Users\vanyle\.choosenim\toolchains\nim-1.6.0\lib\pure\asyncdispatch.nim(1961)  waitFor           
    C:\Users\vanyle\.choosenim\toolchains\nim-1.6.0\lib\pure\asyncdispatch.nim(1653)  poll              
    C:\Users\vanyle\.choosenim\toolchains\nim-1.6.0\lib\pure\asyncdispatch.nim(419)   runOnce           
    C:\Users\vanyle\.choosenim\toolchains\nim-1.6.0\lib\pure\asyncdispatch.nim(234)   processPendingCallbacks                                                                                                   
    C:\Users\vanyle\.choosenim\toolchains\nim-1.6.0\lib\pure\asyncmacro.nim(28)       anonymousNimAsyncContinue                                                                                                 
    C:\Users\vanyle\.choosenim\toolchains\nim-1.6.0\lib\pure\asyncmacro.nim(131)      anonymousIter     
    C:\Users\vanyle\.choosenim\toolchains\nim-1.6.0\lib\pure\asyncfutures.nim(389)    read              
  ]#                                                                                                    
  #[                                                                                                         
    C:\Users\vanyle\.nimble\pkgs\prologue-0.5.2\prologue\core\application.nim(535)    run               
    C:\Users\vanyle\.nimble\pkgs\prologue-0.5.2\prologue\core\application.nim(530)    run               
    C:\Users\vanyle\.nimble\pkgs\prologue-0.5.2\prologue\core\naive\server.nim(30)    serve             
    C:\Users\vanyle\.choosenim\toolchains\nim-1.6.0\lib\pure\asyncdispatch.nim(1961)  waitFor           
    C:\Users\vanyle\.choosenim\toolchains\nim-1.6.0\lib\pure\asyncdispatch.nim(1653)  poll              
    C:\Users\vanyle\.choosenim\toolchains\nim-1.6.0\lib\pure\asyncdispatch.nim(419)   runOnce           
    C:\Users\vanyle\.choosenim\toolchains\nim-1.6.0\lib\pure\asyncdispatch.nim(234)   processPendingCallbacks                                                                                                   
    C:\Users\vanyle\.choosenim\toolchains\nim-1.6.0\lib\pure\asyncmacro.nim(28)       switchNimAsyncContinue                                                                                                    
    C:\Users\vanyle\.choosenim\toolchains\nim-1.6.0\lib\pure\asyncmacro.nim(131)      switchIter        
    C:\Users\vanyle\.choosenim\toolchains\nim-1.6.0\lib\pure\asyncfutures.nim(389)    read              
  ]#                                                                                                    
Exception message: Operation performed on a socket which has not been registered with the dispatcher yet

OS: Windows 11, Nim version: 1.6.0 Source code:

# imports and function definitions ...

var app = newApp(settings = settings) # debug is true
app.use(sessionMiddleware(settings))
app.use(staticFileMiddleware("static"))

app.get("/some_route", render_route1, name = "route1")
app.get("/some_other_route", render_route2, name = "route2")
app.get("/", render_main, name = "main")
app.all("*", render_404)

app.run()

Any idea why ?

ringabout commented 2 years ago

That's strange. Could you try the latest Prologue version (0.5.4) which includes a critical fix?

hmbemba commented 10 months ago

Anyone ever figured the answer to this? Having the same issue on Win10 with prologue 0.6.4 when I use websockets. If I build for linux and run the app using WSL I have no issue.