Bug 165897 - XMLHttpRequest timeout in 60 second in Safari on iOS 10 and above
Summary: XMLHttpRequest timeout in 60 second in Safari on iOS 10 and above
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: Safari 10
Hardware: iPhone / iPad iOS 10
: P2 Major
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-15 05:27 PST by Rahul Tiwari
Modified: 2017-01-31 11:08 PST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rahul Tiwari 2016-12-15 05:27:16 PST
ajax request time out in 60 second in Safari on iOS 10 and above.
the attached url calls a php script that sleeps 60 seconds. It works fine (display alert window and say 'done') in firefox, and will not work in Safari (blank alert window).

Below is the slightly modified script.
test.php?duration=59 will be fine
test.php?duration=60 will be failed.

test.php
------
  <script src="javascripts/prototype.js" type="text/javascript"></script>
<script>
  var myAjax = new Ajax.Request(
    'http://devel.charmm-gui.org/sleep.php',
    {
      method: 'get',
      parameters: 'duration=<?=$_GET['duration']?>',
      onComplete: showResponse
    });

  function showResponse(oReq) {
    alert(oReq.responseText);
  }
</script>
----

sleep.php
----
<?
sleep($_GET['duration']);
echo 'done';
----
Comment 1 Brady Eidson 2016-12-15 08:55:14 PST
Youenn, didn't we fix this in an iOS update? Or has that not yet shipped?
Comment 2 youenn fablet 2016-12-15 09:18:40 PST
It is probably a duplicate of bug 163814 which landed early October.
I don't know whether that shipped yet though.
Comment 3 Alexey Proskuryakov 2016-12-15 18:12:52 PST
Seems like the fix should have shipped in iOS 10.2 this week. Could you please re-test?
Comment 4 Alexey Proskuryakov 2016-12-15 18:20:07 PST
There was another related fix just two days ago, which obviously hasn't shipped yet, see bug 165821.
Comment 5 Rahul Tiwari 2016-12-15 23:10:45 PST
I had checked it in iOS 10.2(Build 14U593) and it still exists.
Comment 6 Alex Christensen 2016-12-16 10:25:29 PST
Could you test to see if https://trac.webkit.org/changeset/209776 fixed your issue?  See https://webkit.org/blog/3457/building-webkit-for-ios-simulator/ for instructions to check Webkit changes on iOS.  It should work with Xcode newer than 6.1.1, too.
Comment 7 Rahul Tiwari 2016-12-20 23:06:30 PST
I am trying to test if https://trac.webkit.org/changeset/209776 fixed the issue. 
But while building WebKit for iOS Simulator by running - 
Tools/Scripts/build-webkit --ios-simulator
Getting below error - 

Check dependencies
Base.xcconfig line 23: Unable to find included file "../../../../Internal/Configurations/HaveInternalSDK.xcconfig"
Base.xcconfig line 23: Unable to find included file "../../../../Internal/Configurations/HaveInternalSDK.xcconfig"
OS X deployment target '10.11' for architecture 'x86_64' and variant 'normal' is greater than the maximum value '10.10' for the OS X 10.10 SDK.

Ld /Users/vgarg/AppleWebkit/webkit/WebKitBuild/Release/LayoutTestRelay normal x86_64
    cd /Users/vgarg/AppleWebkit/webkit/Tools/LayoutTestRelay
    export MACOSX_DEPLOYMENT_TARGET=10.11
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -L/Users/vgarg/AppleWebkit/webkit/WebKitBuild/Release -F/Users/vgarg/AppleWebkit/webkit/WebKitBuild/Release -F/Applications/Xcode.app/Contents/Developer/Library/PrivateFrameworks -filelist /Users/vgarg/AppleWebkit/webkit/WebKitBuild/LayoutTestRelay.build/Release/LayoutTestRelay.build/Objects-normal/x86_64/LayoutTestRelay.LinkFileList -Xlinker -rpath -Xlinker /Applications/Xcode.app/Contents/Developer/Library/PrivateFrameworks -mmacosx-version-min=10.11 -framework CoreSimulator -framework AppKit -fobjc-arc -fobjc-link-runtime -Xlinker -dependency_info -Xlinker /Users/vgarg/AppleWebkit/webkit/WebKitBuild/LayoutTestRelay.build/Release/LayoutTestRelay.build/Objects-normal/x86_64/LayoutTestRelay_dependency_info.dat -o /Users/vgarg/AppleWebkit/webkit/WebKitBuild/Release/LayoutTestRelay
Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_SimServiceContext", referenced from:
      objc-class-ref in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

** BUILD FAILED **


The following build commands failed:
	Ld /Users/vgarg/AppleWebkit/webkit/WebKitBuild/Release/LayoutTestRelay normal x86_64
(1 failure)
Died at Tools/Scripts/build-webkit line 205.
Comment 8 Alex Christensen 2016-12-20 23:13:03 PST
I'm not terribly familiar with that code, but if you open Tools/LayoutTestRelay/LayoutTestRelay.xcodeproj and play with the #defines in CoreSimulatorSPI.h or main.m.  We should fix this, but it probably won't cause any problems for you for this purpose to just comment out any code necessary to get it compiling.  You're not going to use LayoutTestRelay to verify this.
Comment 9 Rahul Tiwari 2016-12-29 05:10:25 PST
I tried to comment out #defines in CoreSimulatorSPI.h and tried few other workarounds as well but unfortunately could not get the build successful for command - Tools/Scripts/build-webkit --ios-simulator

I have a limited knowledge of C/Objective C as so far have been mostly working with Java/J2EE related technologies. It would be great if somebody else can verify if https://trac.webkit.org/changeset/209776 fixed the issue or help me over to get this build running.

Also which version of Safari/iOS would be containing the fix(https://trac.webkit.org/changeset/209776) ?
Comment 10 Brady Eidson 2016-12-29 23:11:15 PST
(In reply to comment #9)
> I tried to comment out #defines in CoreSimulatorSPI.h and tried few other
> workarounds as well but unfortunately could not get the build successful for
> command - Tools/Scripts/build-webkit --ios-simulator
> 
> I have a limited knowledge of C/Objective C as so far have been mostly
> working with Java/J2EE related technologies. It would be great if somebody
> else can verify if https://trac.webkit.org/changeset/209776 fixed the issue
> or help me over to get this build running.
> 
> Also which version of Safari/iOS would be containing the
> fix(https://trac.webkit.org/changeset/209776) ?

That fix has shipped in Safari Technology Preview on macOS
Comment 11 Rahul Tiwari 2016-12-30 00:18:48 PST
(In reply to comment #10)
> (In reply to comment #9)
> > I tried to comment out #defines in CoreSimulatorSPI.h and tried few other
> > workarounds as well but unfortunately could not get the build successful for
> > command - Tools/Scripts/build-webkit --ios-simulator
> > 
> > I have a limited knowledge of C/Objective C as so far have been mostly
> > working with Java/J2EE related technologies. It would be great if somebody
> > else can verify if https://trac.webkit.org/changeset/209776 fixed the issue
> > or help me over to get this build running.
> > 
> > Also which version of Safari/iOS would be containing the
> > fix(https://trac.webkit.org/changeset/209776) ?
> 
> That fix has shipped in Safari Technology Preview on macOS

Hey Brady
I had raised this issue for Safari on iOS. When will this be shipped on iOS ?
Comment 12 Brady Eidson 2016-12-30 10:12:58 PST
(In reply to comment #11)
> (In reply to comment #10)
> > (In reply to comment #9)
> > > I tried to comment out #defines in CoreSimulatorSPI.h and tried few other
> > > workarounds as well but unfortunately could not get the build successful for
> > > command - Tools/Scripts/build-webkit --ios-simulator
> > > 
> > > I have a limited knowledge of C/Objective C as so far have been mostly
> > > working with Java/J2EE related technologies. It would be great if somebody
> > > else can verify if https://trac.webkit.org/changeset/209776 fixed the issue
> > > or help me over to get this build running.
> > > 
> > > Also which version of Safari/iOS would be containing the
> > > fix(https://trac.webkit.org/changeset/209776) ?
> > 
> > That fix has shipped in Safari Technology Preview on macOS
> 
> Hey Brady
> I had raised this issue for Safari on iOS. When will this be shipped on iOS ?

With my WebKit hat on, my reply is:
The WebKit open source project is not in charge of future product releases from any particular vendor.

With my Apple hat on, my reply is:
Apple generally doesn't comment on specific future product releases.

Also with my Apple hat on:
Safari Technology Preview is a glimpse of WebKit changes that Apple plans to ship in future Safari's on both macOS and iOS.
Comment 13 Rahul Tiwari 2017-01-01 22:13:10 PST
(In reply to comment #8)
> I'm not terribly familiar with that code, but if you open
> Tools/LayoutTestRelay/LayoutTestRelay.xcodeproj and play with the #defines
> in CoreSimulatorSPI.h or main.m.  We should fix this, but it probably won't
> cause any problems for you for this purpose to just comment out any code
> necessary to get it compiling.  You're not going to use LayoutTestRelay to
> verify this.

I tried to comment out #defines in CoreSimulatorSPI.h and tried few other workarounds as well but unfortunately could not get the build successful for command - Tools/Scripts/build-webkit --ios-simulator

I have limited knowledge of C/Objective C as so far have been mostly working with Java/J2EE related technologies. It would be great if somebody else can verify if https://trac.webkit.org/changeset/209776 fixed the issue or help me over to get this build running.
Comment 14 Alex Christensen 2017-01-03 12:52:37 PST
Safari Technology Preview only exists on Mac and is not useful for verifying this iOS-specific change that fixed an iOS-specific problem.

To get the build working, comment out this code in Tools/Scripts/build-webkit:
        if (willUseIOSSimulatorSDK()) {
            (system("perl", "Tools/Scripts/build-layouttestrelay", argumentsForConfiguration()) == 0) or die;
        }
Comment 15 Rahul Tiwari 2017-01-20 04:32:08 PST
As suggested i tried commenting out this code in Tools/Scripts/build-webkit -
        if (willUseIOSSimulatorSDK()) {
            (system("perl", "Tools/Scripts/build-layouttestrelay", argumentsForConfiguration()) == 0) or die;
        }
This got me below error - 
/AppleWebkit1/webkit/Source/WTF/wtf/Platform.h:592:5: error: 'TARGET_OS_IOS' is not defined, evaluates to 0 [-Werror,-Wundef]
#if TARGET_OS_IOS

To try to resolve this I added following line to platform.h -
 #define TARGET_OS_IOS 1

This gave below error -
/AppleWebkit1/webkit/Source/WebCore/platform/spi/cocoa/QuartzCoreSPI.h:162:12: error: cannot find interface declaration for 'CASpringAnimation'; did you mean
      'CABasicAnimation'?
@interface CASpringAnimation (Private)
           ^~~~~~~~~~~~~~~~~
           CABasicAnimation

To try to resolve this replaced below line in QuartzCoreSPI.h -
@interface CASpringAnimation (Private) with @interface CABasicAnimation (Private) 

This gave below error -
/AppleWebkit1/webkit/Source/WebCore/platform/graphics/ios/DisplayRefreshMonitorIOS.mm:60:23: error: property 'preferredFramesPerSecond' not found on object of type
      'CADisplayLink *'
        m_displayLink.preferredFramesPerSecond = 60;
                      ^
1 error generated.

Can you please suggest how to resolve the above error and if we are moving in the right direction ?
Comment 16 Alex Christensen 2017-01-23 09:30:46 PST
Just comment out the line with preferredFramesPerSecond in it.  I don't think it'll critically break anything.  Definitely heading in the right direction.
Comment 17 Rahul Tiwari 2017-01-29 23:36:41 PST
(In reply to comment #16)
> Just comment out the line with preferredFramesPerSecond in it.  I don't
> think it'll critically break anything.  Definitely heading in the right
> direction.

Moving ahead tried below mentioned steps - 

Error:

/AppleWebkit1/webkit/Source/WebCore/platform/graphics/ios/DisplayRefreshMonitorIOS.mm:60:23: error: property 'preferredFramesPerSecond' not found on object of type
      'CADisplayLink *'
        m_displayLink.preferredFramesPerSecond = 60;

Action Taken:

Commented out preferredFramesPerSecond in the DisplayRefreshMonitorIOS.mm file.

Error:

Users/vgarg/AppleWebkit1/webkit/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepad.mm:40:31: error: use of undeclared identifier 'GCControllerPlayerIndex'; did you mean
      'GCControllerPlayerIndexUnset'?
    controller.playerIndex = (GCControllerPlayerIndex)(GCControllerPlayerIndex1 + index);
                              ^~~~~~~~~~~~~~~~~~~~~~~
                              GCControllerPlayerIndexUnset

Action Taken:
Commented out the above line.


Error:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.4.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGColorSpace.h:74:29: note: 
      'kCGColorSpaceSRGB' has been explicitly marked unavailable here
CG_EXTERN const CFStringRef kCGColorSpaceSRGB
                            ^
/Users/vgarg/AppleWebkit1/webkit/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:112:72: error: use of undeclared identifier 'kCGColorSpaceDisplayP3'; did you mean
      'ColorSpaceDisplayP3'?
    static CGColorSpaceRef displayP3Space = CGColorSpaceCreateWithName(kCGColorSpaceDisplayP3);
                                                                       ^~~~~~~~~~~~~~~~~~~~~~
                                                                       ColorSpaceDisplayP3

Action Taken:

Replaced line “static CGColorSpaceRef displayP3Space = CGColorSpaceCreateWithName(kCGColorSpaceDisplayP3);” with “static CGColorSpaceRef displayP3Space = displayP3Space;”.

Error:

/Users/vgarg/AppleWebkit1/webkit/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:86:67: error: 'kCGColorSpaceSRGB' is unavailable: not available on iOS
    static CGColorSpaceRef sRGBSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);

Action Taken:

Commented out the method content and all the lines which were calling it.


Error:

/Users/vgarg/AppleWebkit1/webkit/Source/WebCore/html/HTMLInputElement.cpp:1985:12: error: no matching constructor for initialization of 'WTF::String'
    return String { selectionDirection() };

How should we go about tackling the above error ?
Comment 18 Rahul Tiwari 2017-01-31 10:56:34 PST
As getting Webkit build running is taking a lot of time for us, can somebody else here test to verify if the fix (https://trac.webkit.org/changeset/209776) resolves the time out of 60 seconds in Safari on iOS 10 and above ?

This will make things faster.
Comment 19 Alexey Proskuryakov 2017-01-31 11:08:16 PST
I believe the fix should be available in iOS 10.3 public beta 1. Can you try that?