-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
fix(server): launch browsers when file_list is ready #1146
fix(server): launch browsers when file_list is ready #1146
Conversation
If we have a lot of files and a fast starting browser (PhantomJS), the browser might try to connect to the web server before the server is ready to reply, causing the connect mechanism to time out. Make sure to wait until fileList.refresh() is complete before starting the browsers.
ee537a0
to
c77e22a
Compare
@jpommerening Thanks! Do you use |
Short story: I agree we need to fix this issue, but I don't think this PR is the right solution. I'm not sure what is the cause of the issue is. Long story: Here is how Karma works: When a test run starts, all browsers refresh an iframe with actual tests. This iframe points to Thus, capturing of the browser is not delayed until the files are resolved. I'm not sure what the actual cause of your problem is. Sounds like the Karma process is too busy resolving all the files (and possibly preprocessing them) and the webserver does not get scheduled to handle the requests from browser. Can you try it with some GUI browser, eg. Chrome and check out the timeline - how long does it take to serve the initial Let's figure out what the cause is and then we can fix it properly. |
Hey Vojta, Thanks for that excellent summary. I think I understand the whole process a lot better now! I'll follow your suggestions and post the results next week. Also, I'll try to build a small repo to trigger the problem. Have a nice weekend!
|
@jpommerening any updates on this? |
Closing for now. |
After weeks of intermittent timeouts starting PhantomJS I finally found out what's wrong–
We're having a lot of files (well, not that many, maybe a hundred) and we're using
grunt-karma
to trigger single-run tests with PhantomJS in a continuous integration environment.Correct me if I'm wrong, but it looks like the web server is not ready to reply to the browser's connect request until the file list is finished. Since PhantomJS' startup is really quick, it sometimes tries to connect before
fileList.refresh()
completed.After applying this patch, the problem seems to disappear… what do you think?