-
-
Notifications
You must be signed in to change notification settings - Fork 428
Conversation
There are some differences in capybara_webkit and selenium drivers for now
I've started working on some of this in the jf-4-8 branch. The segfaults are caused by a race condition; in Qt 4.8, all HTTP requests are handled in the background thread, which means any data that makes it into the HTTP layer must now be immutable or otherwise threadsafe. The segfault comes from trying to access a deleted string or deleting an already deleted string depending on which thread finishes first, but I haven't been able to track down which string is getting in there yet. I think there may be some fixes in my branch related to the URL and UnsupportedContent issues, so that may be worth looking into. |
@jferris, your fixes do seem to resolve the URL issues for me. For the record, it seems that the behavior of QWebFrame::requestedUrl() was changed from the previous behavior which included pushState/replaceState changes to instead returning only the requested URL, which makes sense. This leaves us with the segfault issue, which I've not been able to track down, and the status code/header issue partially addressed by @fxposter. The status code and headers issues seem to be coming from WebPage::networkAccessManagerFinishedReply(). This method handles setting the status code and headers for the WebPage. The code determines whether or not to set the status code and headers based on the URL of the incoming HTTP response and the URL of the currently focused frame. Somewhere between Qt 4.7 and 4.8, the behavior of the WebPage::finished() signal was changed such that it is fired before the URL of the focused frame is set, causing this issue. I'd opened an upstream bug for this, but haven't heard back (see #315). |
@jferris This pull request is based on your jf-4-8 branch. |
Using valgrind I was able to trace down at least one race condition. It looks like in some cases reset is getting processed after another command has already started. This results in the WebPage which is currently executing an Unfortunately once I got past this isuse, I ran into another very cryptic segfault. valgrind wasn't much help this time around. For reference, here's the backtrace before commenting out |
It looks like the source of our problems is documented here: http://goo.gl/5Fs3S. Specifically,
Putting some debugging in place, I found that the Many thanks to @Huuf for providing a second pair of eyes in debugging. |
@mhoran Excellent find. To make sure I understand correctly, in Qt 4.8, the following sequence can happen and results in a segfault: Is it possible that this is happening because there's an iframe on the page that gets loaded later, and it's the iframe's window that's getting the |
@jferris, that looks to be the case. I don't think the bug is limited to iframes, unfortunately. Every WebPage has a main frame that the JavaScript helpers need to be injected into. However, from further investigation it looks like the JavaScript Window object doesn't always get cleared. I tried adding a makeshift mutex around the |
@mhoran I think we're running into different issues. Here's the backtrace I get pretty reliably:
It always happened directly after finishing a Visit command, and it's always in Removing the I haven't been able to reproduce the same backtrace you've been getting. I'm going to try updating Qt (I'm on 4.8.0) to see if anything changes. |
I get a similar trace in Qt 4.8.1:
|
I've seen this one as well when running the entire test suite. However, when I run just ./spec/integration/driver_spec.rb under valgrind I get the |
@jferris, the I attempted to mitigate this issue by disconnecting the signals from each page in I didn't have much luck analyzing the backtraces from the other segfaults: https://gist.github.com/3615583 and https://gist.github.com/3615579. I ran these tests against Qt 4.8.2, and saw similar issues with 4.8.0. |
@mhoran cool, that's consistent with what I've been seeing. I think we're getting a call to |
We've addressed the segfaults in #403 and the test suite is passing. |
There are some differences in capybara_webkit and selenium drivers for
now.
Also, selenium-webdriver was updated in Gemfile.lock.