saucelabs / sauce-java

A set of helpers for consuming Sauce Labs services from Java
Apache License 2.0
45 stars 61 forks source link

Maven Sauce Connect plugin fais to shutdown tunnel. #39

Closed mehmetg closed 5 years ago

eddiewebb commented 7 years ago

I think i am seeing this. First suite of test runs, but all subsequent invocations of plugin fails.

I was able to recreate locally (by repeated attempts), and its related to pid file. manually deleting it fixes everything, no permission errors, not sure why the plugin cant.

[INFO] --- sauce-connect-plugin:2.1.23:start-sauceconnect (start-sauceconnct) @ statuspage-banner-atlassian-server --- [INFO] Starting Sauce Connect May 03, 2017 5:44:56 PM com.saucelabs.ci.sauceconnect.AbstractSauceTunnelManager activeTunnelIdentifier WARNING: Exception occurred retrieving tunnel information org.json.JSONException: JSONObject["tunnel_identifier"] not a string. at org.json.JSONObject.getString(JSONObject.java:721) at com.saucelabs.ci.sauceconnect.AbstractSauceTunnelManager.activeTunnelIdentifier(AbstractSauceTunnelManager.java:440) at com.saucelabs.ci.sauceconnect.AbstractSauceTunnelManager.openConnection(AbstractSauceTunnelManager.java:289) at com.saucelabs.maven.StartSauceConnectMojo.execute(StartSauceConnectMojo.java:73) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213) at org.apache.maven.cli.MavenCli.main(MavenCli.java:157) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) May 03, 2017 5:44:56 PM com.saucelabs.ci.sauceconnect.AbstractSauceTunnelManager logMessage INFO: /root/sc-4.4.2-linux/bin/sc already exists, so not extracting May 03, 2017 5:44:56 PM com.saucelabs.ci.sauceconnect.SauceConnectFourManager prepAndCreateProcess INFO: Launching Sauce Connect 4.4.2 [/root/sc-4.4.2-linux/bin/sc, -u, eddiewebb, -k, 1e242a24-66c9-4326-8bcd-f917dad39073, -P, 4445] 3 May 17:44:56 - Sauce Connect 4.4.2, build 3154 c8dd102-dirty 3 May 17:44:56 - Using CA certificate bundle /etc/ssl/certs/ca-certificates.crt. 3 May 17:44:56 - Using CA certificate verify path /etc/ssl/certs. May 03, 2017 5:44:56 PM com.saucelabs.ci.sauceconnect.AbstractSauceTunnelManager$StreamGobbler processLine INFO: 3 May 17:44:56 - Sauce Connect 4.4.2, build 3154 c8dd102-dirty May 03, 2017 5:44:56 PM com.saucelabs.ci.sauceconnect.AbstractSauceTunnelManager$StreamGobbler processLine INFO: 3 May 17:44:56 - Using CA certificate bundle /etc/ssl/certs/ca-certificates.crt. 3 May 17:44:56 - Error creating pidfile /tmp/sc_client.pid. May 03, 2017 5:44:56 PM com.saucelabs.ci.sauceconnect.AbstractSauceTunnelManager$StreamGobbler processLine INFO: 3 May 17:44:56 - Using CA certificate verify path /etc/ssl/certs. May 03, 2017 5:44:56 PM com.saucelabs.ci.sauceconnect.AbstractSauceTunnelManager$StreamGobbler processLine INFO: 3 May 17:44:56 - Error creating pidfile /tmp/sc_client.pid. May 03, 2017 5:44:56 PM com.saucelabs.ci.sauceconnect.AbstractSauceTunnelManager$StreamGobbler processLine INFO: ERROR: can't lock pidfile /tmp/sc_client.pid. ERROR: can't lock pidfile /tmp/sc_client.pid. May 03, 2017 5:44:56 PM com.saucelabs.ci.sauceconnect.AbstractSauceTunnelManager logMessage INFO: Sauce Connect can't lock pidfile, attempting to close open Sauce Connect processes [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 15.692 s [INFO] Finished at: 2017-05-03T17:44:56+00:00 [INFO] Final Memory: 61M/475M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal com.saucelabs.maven.plugin:sauce-connect-plugin:2.1.23:start-sauceconnect (start-sauceconnct) on project statuspage-banner-atlassian-server: Execution start-sauceconnct of goal com.saucelabs.maven.plugin:sauce-connect-plugin:2.1.23:start-sauceconnect failed. NullPointerException -> [Help 1] [ERROR]

mehmetg commented 7 years ago

@eddiewebb Would you mind sharing your pom.xml file or project, if possible? That would make an attempt to fix progress much faster.

llaskin commented 7 years ago

Hi Mehmet!

mehmetg commented 7 years ago

@eddiewebb: Sadly I am unable to reproduce the issue. Here's a link to my project where things have been working fine. Also, I'd recommend against using the plugin as it uses a dated version of the SC. @llaskin may be in a better position to comment as I am no longer working at Sauce Labs. I am a customer just like you. :) Also you should check the spelling of sauce connect in your pom.xml as you seem to copy/pasted a typo from the plugin readme.

Here's the more generic sample https://github.com/saucelabs-sample-test-frameworks/Java-TestNG-Selenium/tree/failsafe-with-plugin

llaskin commented 7 years ago

@eddiewebb Have you filed a ticket with our support team? You can email your question directly to help@saucelabs.com. @mehmetg don't worry buddy, we're holding down the fort even without you!

mehmetg commented 7 years ago

@llaskin: I can tell. Things have been running pretty smoothly since I have left. Being a customer I notice! The maven plugin is a bit behind with respect to the jenkins plugin. Java folks need a bit of love too ;)

eddiewebb commented 7 years ago

@mehmetg thanks for the context! Luckily the typo was just the ID, and not phase, so it still started everything properly. Since I changed my plan to run mvn verify (which does include a call to the post-integration phase) things are running much more smoothly.

I was also able to (on a freak occurrence perhaps) get the error running the latest 4.x tunnel locally on my mac osx. So I am thinking the bug regarding PID cleanup is there, not the maven mojo that wraps it.

I'll shoot those details off to the support mailbox @llaskin shared (thanks for that!)

I really do need the maven plugin though as running from BB pipelines does not yet have external connectivity, and spawning a proxy tunnel, monitoring status, etc just adds complexity i don't want in a ephemeral docker image.

Pretty cool results so far! Testing same key UAT tests across 6 main products, min and max compatible versions. screen shot 2017-05-04 at 4 31 58 pm screen shot 2017-05-04 at 4 25 08 pm