4

I've built a web server using Chrome Packaged Apps. The problem I see repeatedly is that chrome.socket.accept() and chrome.socket.write() don't invoke their callback functions. It usually works more or less reliably if request rate is less than 1 request per seconds. If I go above that, then I start seeing errors or missing callbacks.

I did similar tests with sample "webserver" app build by Google (https://github.com/GoogleChrome/chrome-app-samples/tree/master/webserver). It has the same problem. It usually takes less than 100 requests before web server stops responding. The easiest way to reproduce the problem is to use Chrome browser as a client and hold F5 key for few seconds.

It would be desirable to have a sample app that demonstrates how to build reliable web server using chrome.socket. So far I tried several different workarounds for monitoring the situation from the app itself and restarting socket when socket stops working, but it's not easy because there is no reliable way to check the status of the connection or status of the last operation when callback is not fired. I tried to use getInfo() method, but it always returns "connected=true" regardless of the situation.

I saw this on Windows 7 and Chrome OS (Chromebook).

5
  • To clarify: do you see the same rate/speed of failure in your own server as in the server code sample on Github? If it is the same, it seems likely that is a bug in how Chrome handles server sockets. If they are different, it still seems like a bug, but there may be something aggravating the problem in the worse case. Commented Aug 6, 2013 at 20:35
  • I see the same rate/speed of failure in my app and sample app. It does look like bug in how Chrome handles server sockets. Thanks. Commented Aug 7, 2013 at 15:17
  • Yeah, I'd definitely suggest filing a bug at crbug.com (especially since Google's sample app already supplies the test code). Best case, your bug is valid and they fix the underlying socket code. Worst case, there is no bug in the API, but Google fixes the sample server code to work properly. Commented Aug 7, 2013 at 15:23
  • 1
    Your issue (or at least a very closely related issue) has been reported as a bug in Chromium; you can star it to express interest in the bug and get updates. Commented Aug 7, 2013 at 19:51
  • Thanks for the tip @apsillers. I starred that issue and added my comment as well. Hope this bug will get some attention. Commented Aug 7, 2013 at 21:12

2 Answers 2

1

Just an update on this. According to this the issue is now fixed.

Sign up to request clarification or add additional context in comments.

Comments

1

There are still other problems with the sample web server application. I noticed that I could make the sample app lock up by holding down Ctrl-R in the browser. I wrote a more robust one that you can use here: https://github.com/kzahel/web-server-chrome

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.