New issue
Advanced search Search tips

Issue 913373 link

Starred by 3 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug-Regression



Sign in to add a comment

In chrome version 69.0.3497.100 the http requests being made when application in background stops working

Reported by arun.ram...@motorolasolutions.com, Dec 10

Issue description

Example URL:

Steps to reproduce the problem:
1. Have a sample android application which does remote http request every 5 mins to get the content.
2. Put the application to background. After 30 mins idle pls check the request response behavior
3. After 30 mins the webview is not dispatching the requests to remote host or local host till the application is brought to foreground

What is the expected behavior?
Webview should not block/queue the requests when the application in background

What went wrong?
In our application we use local IP using 127.0.0.1 to share the data between 2 modules and this stops working after 30 mins idle. Same problem seen in chrome version 70 also

Did this work before? Yes 68.0.3440.91

Chrome version: 69.0.3497.100  Channel: stable
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version:
 
Cc: asanka@chromium.org
Labels: Needs-triage-Mobile
Correction : This is on Android Platform and not on Windows
We tested below versions and see the same behavior :
Chrome BETA:  Version/4.0 Chrome/71.0.3578.83 

Chrome Canary: Version/4.0 Chrome/73.0.3636.

Chrome Dev: Version/4.0 Chrome/72.0.3626.7

Cc: chelamcherla@chromium.org
Labels: Triaged-Mobile Needs-Feedback
@ arun.ramamoorthy: Please provide sample apk to test this issue from our end, screencast of issue would also be helpful in further triaging.

Thanks!
Attaching the sample application and the src project.

How it works :
1. We are having an alarm that expires every 5 mins
2. On Alarm expiry we do request to https://www.google.com and print the response code.

Log Snippets to check in ADB logs:
 "Request sent ====> www.google.com", source: file:///android_asset/www/js/index.js

"Got success response:: 200",


Steps to follow :
Install the application and launch
Put it to background by pressing home key of the device.
Take the ADB logs after 1 hr idle and check for the request and response.

Observation:
If the application is kept foreground by not allowing the device display go off it works well.
If the application pushed to background and lock the device it stops working.

SampleWebview.apk
1.6 MB Download
Project Member

Comment 7 by sheriffbot@chromium.org, Dec 13

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding the requester to the cc list.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Uploading the project src as split zip files.
sampleApp.zip
6.4 MB Download
sampleApp.z01
6.4 MB Download
Components: Mobile>WebView
I was looking at your app trying to make sure I understand it.  It looks like it runs a Service and attempts to have the WebView perform a fetch every 5 minutes.
Does logging indicate that after 30 minutes the Service stops getting the alarm, or only that the WebView isn't performing the fetch?
I wonder if the Service is getting killed after 30 minutes like this documents:
https://developer.android.com/guide/components/activities/process-lifecycle
I was looking at your app trying to make sure I understand it.  It looks like it runs a Service and attempts to have the WebView perform a fetch every 5 minutes.
Does logging indicate that after 30 minutes the Service stops getting the alarm, or only that the WebView isn't performing the fetch?
I wonder if the Service is getting killed after 30 minutes like this documents:
https://developer.android.com/guide/components/activities/process-lifecycle
Paul,
We have designed the sample application in a way that it's service not get killed when application put to background. If you run the application you can see from the logging that the below log snippets prints every 5 mins on alarm expiry :
Alarms Timer expired
Request sent ====> www.google.com

Problem we face is the request is not sent out by webview when put to background.
Hi, I'm also facing similar issues here,

1.setTimeout() issue: Timer is not getting expired when application is in Background. issue was observed in M55 but in later releases it got fixed.

Old bug found in M55

https://bugs.chromium.org/p/chromium/issues/detail?id=657708

2. Websockets are internally getting closed when app is put into background.
We see socket close immediately when application comes to foreground. 




The logging from comment #13 indicates the request made it to JS and an XMLHttpRequest was issued.

WebView folks, any idea how to debug this deeper?  Is there anything equivalent to chrome://net-export in WebView?  Have you seen this issue before?
Are you sure this is specific to WebView, and not one of the platform-wide restrictions on background activity that have been introduced in recent Android versions? (https://developer.android.com/guide/background/#restrictions)

Try also making a network connection in Java without using the WebView (e.g. HttpUrlConnection) at the same time, and see if that works?
YEs we are sure it is related to the webview.If you run the same sample application on webview version 68 it works fine on the same device.
Cc: -chelamcherla@chromium.org pauljensen@chromium.org sindhu.chelamcherla@chromium.org ntfschr@chromium.org
Owner: pauljensen@chromium.org
Status: Assigned (was: Unconfirmed)
> Is there anything equivalent to chrome://net-export in WebView?  Have you seen this issue before?

You might be looking for http://go/clank-webview/net-debugging. Let me know if this helps out and I'll prioritize the related network service work.

Passing to pauljensen@ for network investigation, but let me know if someone else should take this.
Labels: Needs-Feedback
Owner: ----
Status: Unconfirmed (was: Assigned)
Can you please try the suggestion from comment 16:
Try also making a network connection in Java without using the WebView (e.g. HttpUrlConnection) at the same time, and see if that works?
@paul.
We used Okhttp and java request/Response works. JS/Webivew request fails to get response.

Attached is the sample app.

Logs to check in ADB.

JS:"Got success response:: 200"

Java: "JAVA HTTP RESPONSE:"


SampleWebviewApp.zip
1.5 MB Download
> JS:"Got success response:: 200"

This sounds like JS/WebView request is succeeding?
JS or webview level it failed to get response.JS got response only once in 30 mins.In sample app we make request every 5 mins. Java gets response every 5 mins .


Please run the sample project on any google device and take adb logs.

The successful repsonse search key is as above for java and JS.

Owner: torne@chromium.org
Status: Assigned (was: Unconfirmed)
torne@chromium.org: This sure looks WebView specific at this point. Feel free to assign back to pauljensen if you disagree.
Labels: Needs-Bisect
Owner: ----
Status: Available (was: Assigned)
Probably easiest to get a bisect on this if it broke between 68 and 69, then.

Comment 25 by r.arunpr...@gmail.com, Jan 21 (2 days ago)

Please update on this ..its blocking our releases.

Comment 26 by chelamcherla@chromium.org, Yesterday (43 hours ago)

Cc: -sindhu.chelamcherla@chromium.org chelamcherla@chromium.org
@arun.ramamoorthy: Could you please provide .apk file instead of zip file? Or please let us know how to install the app from attached folder in c#20. A screencast would help in faster triaging.

Thanks!

Comment 27 by r.arunpr...@gmail.com, Today (20 hours ago)

Pls find attached the .apk file ..
webview_JAVA_JS.7z
1.6 MB Download

Sign in to add a comment