Failed to set Chrome's command line file on device for long command line |
||||
Issue descriptionChrome Version: Android Stable OS: Android I'm creating a test framework on top of chromedriver which uses some very long command line arguments to test combinations of field trials. Using an attached Nexus 6p, chromedriver will set /data/local/tmp/chrome-command-line to a maximum of 4019 bytes, and not one more. To reproduce: WORKING ======= /usr/bin/python tools/chrome_proxy/webdriver/run_all_tests.py out/Default/chromedriver --android -f --test_filter=Bypass.testBadHTTPSFallback --browser_args='--force-fieldtrials=AlternateComponentUrls/AlternateComponentUrls/AndroidAIAFetching/Enabled/AndroidSpellChecker/Enabled_NonLowEnd/AsyncDns/AsyncDnsA/AutodetectEncoding/Enabled/AutofillClassifier/Enabled/AutofillCreditCardDropdownVariations/LastUsedDate_IncreaseDropdownItemHeight_Experiment/AutofillCreditCardSigninPromo/EnabledThree/AutofillFieldMetadata/Enabled/AutofillProfileCleanup/Enabled/AutofillProfileOrderByFrecency/EnabledLimitTo3/BackgroundVideoOptimizations/BackgroundOptimizationEnabled1sOrLessMediaSource/BrowserScheduler/RedirectWithDefaultInitParams/CSSExternalScanner/Enabled_ScanAndPreload/ChromotingQUIC/Enabled/CopylessPaste/Enabled/DataCompressionProxyDevRollout/Control/DataCompressionProxyLoFi/Enabled/DataCompressionProxyPromoVisibility/Enabled/DataReductionProxyFREPromo/Enabled_Warmup/DataReductionProxyMainMenu/Enabled/DataReductionProxyServerExperiments/Brotli/DataReductionProxyUseQuic/Enabled/DefaultEnableGpuRasterization/DefaultEnableGpuRasterization/DelayNavigation/DelayNavigation/DisallowFetchForDocWrittenScriptsInMainFrame/DocumentWriteEvaluatorGroup/DownloadsUi/Enabled/EnableMediaThreadForMediaPlayback/Enabled/EnableSyncClientToServerCompression/Enabled/EnableSyncUSSDeviceInfo/Enabled/ExpectCTReporting/ExpectCTReportingEnabled/ExpensiveBackgroundTimerThrottling/Enabled_30sMaxThrottilingDelay/FasterLocationReload/Enabled/HttpFormWarning/Enabled/IdleTimeSpellChecking/Enabled/ImportantSitesInCBD/DialogEnabled/InstantApps/InstantAppsEnabled/InvalidationsGCMUpstream/Enabled/LazyParseCSS/Control/LimitSyncPassphrasePrompt/Enabled/LoadingWithMojo/Enabled/LsdPermissionPrompt/Enabled/MarkNonSecureAs/show-non-secure-passwords-cc-ui/MidiManagerAndroid/Enabled/MidiManagerDynamicInstantiation/Enabled/MojoChannel/Enabled/NTPArticleSuggestions/Enabled-ChromeReader/NTPFaviconsFromNewServer/Enabled/NTPLaunchAfterInactivity/OneHourDelay/NTPMostLikelyFaviconsFromServer/Enabled/NTPPersonalizedSectionRanking/Enabled-ClickBasedRanker/NTPPopularSites/EnabledFull/NTPPreferAmpUrls/Enabled/NTPRecentForeignTabs/Enabled-ThreeHour/NetDelayableH2AndQuicRequests/Enabled/NetworkQualityEstimator/Enabled/NetworkSchedulerYielding/Enabled/NetworkTimeQueries/NetworkTimeQueriesEnabledOnDemand/NoCreditCardAbort/Disabled/NoStatePrefetchValidation/PrerenderDisabled_R2/OfferUploadCreditCards/Enabled/OfflinePageCache/Enabled/OfflinePages/EnabledAsBookmarks/OfflinePagesAsyncLoading/Enabled/OmniboxBundledExperimentV1/Dev_Android_ClipboardProvider_Enabled/PageRevisitInstrumentation/Enabled/ParallelDownloading/Enabled/PassiveDocumentEventListeners/Enabled/PassiveEventListenersDueToFling/Enabled/PasswordBranding/SmartLockBrandingSavePromptOnly/PasswordManagerSettingsMigration/Enable/PasswordMetadataFilling/Enabled/PermissionPromptUIAndroid/BlockPromptsEnabled/PermissionPromptUIAndroidModal/ModalToggleEnabled/PersistentHistograms/EnabledOnDiskNoStability3/PhysicalWeb/Enabled/PointerEvent/Enabled/Precache/EnabledCGRUV20b/PreconnectMore/Enabled/ProgressBarAnimationAndroid/SmoothIndeterminateAnimation/ProgressBarCompletion/progress-bar-completion-resources-before-domContentLoaded/QUIC/Enabled/RafAlignedMouseInput/Enabled/RafAlignedTouchInput/Enabled/ReaderModeUI/AdaBoost/ReaderModeUIFeedback/Show/ReportCertificateErrors/ShowAndPossiblySend/ReportingAPI/ReportingEnabled/SafeBrowsingAndroid/Enabled/SafeBrowsingScoutTransitionStudy/CanShowScoutOptInGroup2/SafeBrowsingThreatDomDetailsTagAttributes/Enabled/SafeBrowsingUseLocalBlacklist/Use3PAPI/SchedulerExpensiveTaskBlocking/Enabled/SdchPersistence/Enabled/SearchGeolocationConsistency/EnableExperiment/SeccompSandboxAndroid/SandboxEnabled/ServiceWorkerNavigationPreload/Enabled/SpeculativeLaunchServiceWorker/Enabled/StrictS' NOT WORKING =========== /usr/bin/python tools/chrome_proxy/webdriver/run_all_tests.py out/Default/chromedriver --android -f --test_filter=Bypass.testBadHTTPSFallback --browser_args='--force-fieldtrials=AlternateComponentUrls/AlternateComponentUrls/AndroidAIAFetching/Enabled/AndroidSpellChecker/Enabled_NonLowEnd/AsyncDns/AsyncDnsA/AutodetectEncoding/Enabled/AutofillClassifier/Enabled/AutofillCreditCardDropdownVariations/LastUsedDate_IncreaseDropdownItemHeight_Experiment/AutofillCreditCardSigninPromo/EnabledThree/AutofillFieldMetadata/Enabled/AutofillProfileCleanup/Enabled/AutofillProfileOrderByFrecency/EnabledLimitTo3/BackgroundVideoOptimizations/BackgroundOptimizationEnabled1sOrLessMediaSource/BrowserScheduler/RedirectWithDefaultInitParams/CSSExternalScanner/Enabled_ScanAndPreload/ChromotingQUIC/Enabled/CopylessPaste/Enabled/DataCompressionProxyDevRollout/Control/DataCompressionProxyLoFi/Enabled/DataCompressionProxyPromoVisibility/Enabled/DataReductionProxyFREPromo/Enabled_Warmup/DataReductionProxyMainMenu/Enabled/DataReductionProxyServerExperiments/Brotli/DataReductionProxyUseQuic/Enabled/DefaultEnableGpuRasterization/DefaultEnableGpuRasterization/DelayNavigation/DelayNavigation/DisallowFetchForDocWrittenScriptsInMainFrame/DocumentWriteEvaluatorGroup/DownloadsUi/Enabled/EnableMediaThreadForMediaPlayback/Enabled/EnableSyncClientToServerCompression/Enabled/EnableSyncUSSDeviceInfo/Enabled/ExpectCTReporting/ExpectCTReportingEnabled/ExpensiveBackgroundTimerThrottling/Enabled_30sMaxThrottilingDelay/FasterLocationReload/Enabled/HttpFormWarning/Enabled/IdleTimeSpellChecking/Enabled/ImportantSitesInCBD/DialogEnabled/InstantApps/InstantAppsEnabled/InvalidationsGCMUpstream/Enabled/LazyParseCSS/Control/LimitSyncPassphrasePrompt/Enabled/LoadingWithMojo/Enabled/LsdPermissionPrompt/Enabled/MarkNonSecureAs/show-non-secure-passwords-cc-ui/MidiManagerAndroid/Enabled/MidiManagerDynamicInstantiation/Enabled/MojoChannel/Enabled/NTPArticleSuggestions/Enabled-ChromeReader/NTPFaviconsFromNewServer/Enabled/NTPLaunchAfterInactivity/OneHourDelay/NTPMostLikelyFaviconsFromServer/Enabled/NTPPersonalizedSectionRanking/Enabled-ClickBasedRanker/NTPPopularSites/EnabledFull/NTPPreferAmpUrls/Enabled/NTPRecentForeignTabs/Enabled-ThreeHour/NetDelayableH2AndQuicRequests/Enabled/NetworkQualityEstimator/Enabled/NetworkSchedulerYielding/Enabled/NetworkTimeQueries/NetworkTimeQueriesEnabledOnDemand/NoCreditCardAbort/Disabled/NoStatePrefetchValidation/PrerenderDisabled_R2/OfferUploadCreditCards/Enabled/OfflinePageCache/Enabled/OfflinePages/EnabledAsBookmarks/OfflinePagesAsyncLoading/Enabled/OmniboxBundledExperimentV1/Dev_Android_ClipboardProvider_Enabled/PageRevisitInstrumentation/Enabled/ParallelDownloading/Enabled/PassiveDocumentEventListeners/Enabled/PassiveEventListenersDueToFling/Enabled/PasswordBranding/SmartLockBrandingSavePromptOnly/PasswordManagerSettingsMigration/Enable/PasswordMetadataFilling/Enabled/PermissionPromptUIAndroid/BlockPromptsEnabled/PermissionPromptUIAndroidModal/ModalToggleEnabled/PersistentHistograms/EnabledOnDiskNoStability3/PhysicalWeb/Enabled/PointerEvent/Enabled/Precache/EnabledCGRUV20b/PreconnectMore/Enabled/ProgressBarAnimationAndroid/SmoothIndeterminateAnimation/ProgressBarCompletion/progress-bar-completion-resources-before-domContentLoaded/QUIC/Enabled/RafAlignedMouseInput/Enabled/RafAlignedTouchInput/Enabled/ReaderModeUI/AdaBoost/ReaderModeUIFeedback/Show/ReportCertificateErrors/ShowAndPossiblySend/ReportingAPI/ReportingEnabled/SafeBrowsingAndroid/Enabled/SafeBrowsingScoutTransitionStudy/CanShowScoutOptInGroup2/SafeBrowsingThreatDomDetailsTagAttributes/Enabled/SafeBrowsingUseLocalBlacklist/Use3PAPI/SchedulerExpensiveTaskBlocking/Enabled/SdchPersistence/Enabled/SearchGeolocationConsistency/EnableExperiment/SeccompSandboxAndroid/SandboxEnabled/ServiceWorkerNavigationPreload/Enabled/SpeculativeLaunchServiceWorker/Enabled/StrictSe'
,
May 31 2017
Further analysis: Response received from ExecuteHostShellCommand in AdbImpl::SetCommandLineFile is not 0 (success) and hence the error. I executed adb shell command manually and below is the observation: 1) Without "--force-fieldtrials" : ./adb shell echo "chrome --disable-fre --disable-popup-blocking --enable-automation --enable-remote-debugging --ignore-certificate-errors --metrics-recording-only" > /tmp/chrome-command-line; echo $? => response received is 0 2) With above reduced "--force-fieldtrials" : ./adb shell echo "chrome --disable-fre --disable-popup-blocking --enable-automation --enable-remote-debugging --ignore-certificate-errors --metrics-recording-only --force-fieldtrials=AlternateComponentUrls/AlternateComponentUrls/AndroidAIAFetching/Enabled/AndroidSpellChecker/Enabled_NonLowEnd/AsyncDns/AsyncDnsA/AutodetectEncoding/Enabled/AutofillClassifier/Enabled/AutofillCreditCardDropdownVariations/LastUsedDate_IncreaseDropdownItemHeight_Experiment/AutofillCreditCardSigninPromo/EnabledThree/AutofillFieldMetadata/Enabled/AutofillProfileCleanup/Enabled/AutofillProfileOrderByFrecency/EnabledLimitTo3/BackgroundVideoOptimizations/BackgroundOptimizationEnabled1sOrLessMediaSource/BrowserScheduler/RedirectWithDefaultInitParams/CSSExternalScanner/Enabled_ScanAndPreload/ChromotingQUIC/Enabled/CopylessPaste/Enabled/DataCompressionProxyDevRollout/Control/DataCompressionProxyLoFi/Enabled/DataCompressionProxyPromoVisibility/Enabled/DataReductionProxyFREPromo/Enabled_Warmup/DataReductionProxyMainMenu/Enabled/DataReductionProxyServerExperiments" > /tmp/chrome-command-line; echo $? => response received is error: service name too long 255 3) again, reduced the argument string: ./adb shell echo "chrome --disable-fre --disable-popup-blocking --enable-automation --enable-remote-debugging --ignore-certificate-errors --metrics-recording-only --force-fieldtrials=AlternateComponentUrls/AlternateComponentUrls/AndroidAIAFetching/Enabled/AndroidSpellChecker/Enabled_NonLowEnd/AsyncDns/AsyncDnsA/AutodetectEncoding/Enabled/AutofillClassifier/Enabled/AutofillCreditCardDropdownVariations/LastUsedDate_IncreaseDropdownItemHeight_Experiment/AutofillCreditCardSigninPromo/EnabledThree/AutofillFieldMetadata/Enabled/AutofillProfileCleanup/Enabled/AutofillProfileOrderByFrecency/EnabledLimitTo3/BackgroundVideoOptimizations/BackgroundOptimizationEnabled1sOrLessMediaSource/BrowserScheduler/RedirectWithDefaultInitParams/CSSExternalScanner/Enabled_ScanAndPreload/ChromotingQUIC/Enabled/CopylessPaste/Enabled/DataCompressionProxyDevRollout/Control/DataCompressionProxyLoFi/Enabled/DataCompressionProxyPromoVisibility/Enabled/DataReductionProxyFREPromo/Enabled_Warmup" > /tmp/chrome-command-line; echo $? => response received is 0 Looks like problem is related to long length of the command. We may (?) have to figure out how to send long input in adb shell command.
,
Jun 2 2017
I tried a workaround by modifying ExecuteHostShellCommand in AdbImpl::SetCommandLineFile :- * wrote the [ comment#2 : 2) ] long command to a shell file . * pushed the file using adb push . * executed it on the device using sh. => This works fine and "Failed to set Chrome's.. " error is no longer seen but it throws ChromeNotReachable error. Chrome browser is crashing immediately on launching. Whereas If I perform this workaround using the reduced [comment#2 : 3) ] command, Chromedriver successfully launches Chrome without any issues. This appears to be problem on android Chrome browser side. Chrome android browser crashes on passing the long command input. Below are the manual steps to reproduce:- (Attaching the longcommand.sh file). i)Run ./adb push longcommand.sh /data/local/tmp ii) Run ./adb shell sh /data/local/tmp/longcommand.sh iii) Launch Chrome browser
,
Jun 5 2017
With longcommand.sh from comment#3, Chrome failed to start because the last field trial name isn't complete, not due to command line length issue. I was able to start Chrome with a much longer command line (see attached verylongcommand.sh), as long as I make sure the field trial names are valid. The original issue appears to be due to adb limitations. The length of the command line that can be sent through adb actually depends on the adb version. With current adb (version 1.0.39), about 4000 characters can be sent. With an older version (1.0.31), only about 1000 characters are allowed. Robert: How important is it to have a fix for this bug? It should be possible to fix it by directly pushing the chrome-command-line file through adb, instead of sending a long command line (similar to the workaround in comment#3, but it would be easier to directly push chrome-command-line file, instead of pushing a shell script that generates this file).
,
Jun 5 2017
We would certainly like to have this testing ability. Our primary user base is on Android and we don't have any similar kind of test coverage
,
Jun 28 2017
John, any updates on this?
,
Jun 28 2017
Working on it. Hopefully will have a fix in a few days.
,
Jul 14 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/4e04992e510213a402ea51649a6e9a45ff1a5f10 commit 4e04992e510213a402ea51649a6e9a45ff1a5f10 Author: johnchen <johnchen@chromium.org> Date: Fri Jul 14 18:21:53 2017 [Chromedriver] Support long command line on Android On Android devices, ChromeDriver used to use shell "echo" command to send Chrome command line to the device. Adb limits the length of the command line that can be sent this way, ranging from less than 1000 characters to about 4000 characters, depending on the Adb version. To allow longer command line to be used, ChromeDriver now uses Adb file transfer protocol to send the command line file to the device. This is the same underlying protocol used by "adb push" command. BUG= 727979 Review-Url: https://codereview.chromium.org/2972913002 Cr-Commit-Position: refs/heads/master@{#486815} [modify] https://crrev.com/4e04992e510213a402ea51649a6e9a45ff1a5f10/chrome/test/chromedriver/chrome/adb_impl.cc [modify] https://crrev.com/4e04992e510213a402ea51649a6e9a45ff1a5f10/chrome/test/chromedriver/net/adb_client_socket.cc [modify] https://crrev.com/4e04992e510213a402ea51649a6e9a45ff1a5f10/chrome/test/chromedriver/net/adb_client_socket.h
,
Jul 14 2017
Fix is checked in, and will be part of ChromeDriver release 2.31.
,
Jul 18 2017
Thanks John, it's working now!! |
||||
►
Sign in to add a comment |
||||
Comment 1 by gmanikpure@chromium.org
, May 31 20179.2 KB
9.2 KB View Download