[Webkit-unassigned] [Bug 125008] New: Safari 7.0 Intermittent Ajax Failures
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Nov 29 05:15:46 PST 2013
https://bugs.webkit.org/show_bug.cgi?id=125008
Summary: Safari 7.0 Intermittent Ajax Failures
Product: WebKit
Version: 528+ (Nightly build)
Platform: Macintosh
OS/Version: Mac OS X 10.9
Status: NEW
Severity: Major
Priority: P2
Component: Page Loading
AssignedTo: webkit-unassigned at lists.webkit.org
ReportedBy: wbyoung at gmail.com
With Safari 7.0 for Mac OS X 10.9 Mavericks (specifically 9537.71), a web app that I work on started to have intermittent failures for Ajax requests through jQuery. This was never something that I was able to reproduce with Safari 7.0.
Environment:
- Rails 4.0.0 (also 4.0.1)
- jQuery Rails 3.0.4
- jQuery 1.10.2
Request Details:
- Uses UJS
- Uses SSL
- Not cross domain
- The settings passed to the `ajax:beforeSend` UJS event [are here](https://gist.github.com/wbyoung/7697316).
## Intermittent Error
The `ajax:error` UJS event was triggered when the request failed. The error message was `SyntaxError: JSON Parse error: Unexpected EOF`. The XHR would have ready state of `4` with an empty response and status of `200`. There's [indication](http://stackoverflow.com/questions/4472051/jquery-json-request-gets-a-200-ok-answer-but-no-content) that this is due to the browser rejecting the request since it doesn't conform to the same-origin policy. This was in line what I saw on the server side — nothing. There was no matching request for the client IP that experienced this error; the AJAX request never made it to the server. Contrary to the idea of this being related to same-origin policy, though, these requests were made relative to the host (`/some/url`) so it absolutely should not fail the same-origin policy test & should not be subject to cross domain rules. Also, if this were related to a cross-domain issue, one would expect consistent failures. Interestingly, this seemed to happen consistently for certain users, but there were cases of them re-trying and things working properly later.
This issue happened for about 30% (ballpark) of requests with this specific version of Safari. It never happened with any other browser. This is a pretty critical part of the app, so I've been trying a slew of workarounds to what I'm assuming is a browser bug, but have yet to find any reports of such an issue.
## Attempted Fixes
Attempted fixes without success:
- Originally the page's _GET_ and _POST_ URLs were the same, so I tried having the request post elsewhere.
- I tried making the URL absolute instead.
These attempted fixes did not change anything.
Also, in diagnosing this problem, I used a basic AJAX request to post errors back to the server and get better reporting on what was going on. I noticed that some of these requests were failing as well (partial error reporting still helped in troubleshooting). So overall, it didn't seem like anything directly related to Rails, jQuery, or UJS.
## JSONP Solution?
Finally, I switched the request to use JSONP today, and it's been pretty successful. There was one failure, but that failure could have been for other reasons (still investigating).
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list