Opened 5 years ago

Closed 8 months ago

Last modified 8 months ago

#11108 closed bug (no change required)

app_server WebWorker writeSize invalid on secondary connection attempts

Reported by: kallisti5 Owned by: kallisti5
Priority: normal Milestone: Unscheduled
Component: Servers/app_server Version: R1/Development
Keywords: html5 Cc: ttcoder
Blocked By: Blocking:
Has a Patch: no Platform: All

Description

Opening an initial connection to the app_server HTML5 target works. Any additional connections to the original port fail:

KERN: WebServer: new endpoint connection: 0x18972248
KERN: WebServer: searching handler for 'output'
KERN: WebHandler: 'output' <> 'input' 6
KERN: WebHandler: 'output' <> 'output' 0
KERN: WebServer: found handler 'output'
KERN: WebWorker: new endpoint connection: 0x18972248
KERN: WebWorker: readSize 4096
KERN: WebWorker: writeSize -1
KERN: WebWorker: writing to peer failed: General system error
KERN: WebWorker: readSize 4096
KERN: WebWorker: writeSize 4096
KERN: WebServer: new endpoint connection: 0x18971e68
KERN: WebServer: read 0 bytes, retrying
KERN: WebWorker: readSize 4096
KERN: WebWorker: writeSize -1
KERN: WebWorker: writing to peer failed: General system error
KERN: WebServer: read 0 bytes, retrying

Change History (6)

comment:1 Changed 5 years ago by kallisti5

testing with:

TARGET_SCREEN=html5:80 StyledEdit

comment:2 Changed 5 years ago by ttcoder

Cc: degea@… added

I also have the "can connect only once, then a reboot is needed" symptom using the RemoteDesktop target; didn't check if the underlying problem is the same as here on the HTML5 target but at any rate this is very interesting

comment:3 Changed 5 years ago by kallisti5

I found that killing and restarting the app_server doesn't help. However, if I choose a different port, things will work on that port (well.. once)

comment:4 Changed 5 years ago by ttcoder

Could it be that app_server needs to call setsockopt(..SO_REUSEADDR) or SO_REUSEPORT ? The intertubes say that the use-case for needing it is if bind() returns error EINUSE. In fact,

  • searching for either constant comes up empty in ap_server/
  • HTML5DrawingEngine.cpp:92 could potentially affect value EINUSE to fInitStatus
  • the trouble is that the init status is not used for error reporting, only for bailing out in ScreenManager.cpp:194
  • looking at the code more closely and/or adding tracing could reveal if app_server and/or the client might attempt some uncalled-for write on an unbinded socket; if so, then setsockopt()might be the answer? Or maybe I'm just blowing smoke and the "write to peer failed" is something else entirely

Hmmm re-reading myself I realize the problematic bind() could be on the client side too, not just app_server side. Also will keep this link for my reference: http://www.freelists.org/post/haiku-development/app-server-html5-interface

comment:5 Changed 8 months ago by waddlesplash

Resolution: no change required
Status: newclosed

HTML5 backend for app_server was removed in favor of the HTML5 RemoteDesktop client.

comment:6 Changed 8 months ago by ttcoder

Cc: ttcoder added; degea@… removed
Note: See TracTickets for help on using tickets.