[ 
https://issues.apache.org/jira/browse/SUREFIRE-1157?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14550415#comment-14550415
 ] 

Kristian Rosenvold commented on SUREFIRE-1157:
----------------------------------------------

I know from my work in the selenium project that allocating ports is a fast 
path to a place with guys wielding pitchforks and lots of flames. It's even 
worse than parsing [XML with regex | 
http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags].
 So we dont allocate ports; ever. I will veto any change that allocates 
sockets. I will actually raise from the grave even after my death to haunt 
anyone that even tries to code a patch to allocate sockets for this. Even JNI 
is moderately acceptable when compared to the eternal damnation faced by Those 
Who Allocate Ports. JNI-based OS specific strategies with a fallback to the 
current strategy sounds infinitely plausible compared allocating TCP ports. 
Shared memory, Named pipes or unix domain sockets, morse code or screen 
scraping are all preferable.

If we were to try anything shared-memory like we must also consider that Unsafe 
is gone in java9, so there'd have to be something like a memory mapped file 
(but they are riddled with caveats on windows, so we'd need something different 
there :). Which would also mean we'd have to find some way to spoof the 
security manager (I /think/ it was possible to turn the security manage on 
*after* doing initial setup, but this is about 5 years ago for me and I have 
trouble remembering what I ate for dinner yesterday)

It would appear to me that it would be wise to start something like this by 
making it possible to choose different strategies, hopefully just by inspecting 
OS level features.

> Surefire fork communication fails when a native library writes to stdout
> ------------------------------------------------------------------------
>
>                 Key: SUREFIRE-1157
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1157
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: process forking
>    Affects Versions: 2.17
>            Reporter: Dan Berindei
>
> We are seeing this exception in some of our CI builds:
> {noformat}
> [11:17:10]W:   [Step 2/4] [ERROR] Failed to execute goal 
> org.apache.maven.plugins:maven-surefire-plugin:2.17:test (default-test) on 
> project infinispan-cachestore-leveldb: Execution default-test of goal 
> org.apache.maven.plugins:maven-surefire-plugin:2.17:test failed: 
> java.lang.RuntimeException: 
> 1,org.infinispan.persistence.leveldb.LevelDBStoreTest,testStoreAndRemove(org.infinispan.persistence.leveldb.LevelDBStoreTest),unit,null,null:
>  NoSuchElementException -> [Help 1]
> [11:17:10] :   [Step 2/4] 
> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute 
> goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test (default-test) 
> on project infinispan-cachestore-leveldb: Execution default-test of goal 
> org.apache.maven.plugins:maven-surefire-plugin:2.17:test failed: 
> java.lang.RuntimeException: 
> 1,org.infinispan.persistence.leveldb.LevelDBStoreTest,testStoreAndRemove(org.infinispan.persistence.leveldb.LevelDBStoreTest),unit,null,null
> [11:17:10] :   [Step 2/4]     at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
> [11:17:10] :   [Step 2/4]     at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
> [11:17:10] :   [Step 2/4]     at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
> [11:17:10] :   [Step 2/4]     at 
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
> [11:17:10] :   [Step 2/4]     at 
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
> [11:17:10] :   [Step 2/4]     at 
> org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
> [11:17:10] :   [Step 2/4]     at 
> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
> [11:17:10] :   [Step 2/4]     at 
> org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
> [11:17:10] :   [Step 2/4]     at 
> org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
> [11:17:10] :   [Step 2/4]     at 
> org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
> [11:17:10] :   [Step 2/4]     at 
> org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
> [11:17:10] :   [Step 2/4]     at 
> org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
> [11:17:10] :   [Step 2/4]     at 
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> [11:17:10] :   [Step 2/4]     at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> [11:17:10] :   [Step 2/4]     at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> [11:17:10] :   [Step 2/4]     at 
> java.lang.reflect.Method.invoke(Method.java:483)
> [11:17:10] :   [Step 2/4]     at 
> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
> [11:17:10] :   [Step 2/4]     at 
> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
> [11:17:10] :   [Step 2/4]     at 
> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
> [11:17:10] :   [Step 2/4]     at 
> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
> [11:17:10] :   [Step 2/4] Caused by: 
> org.apache.maven.plugin.PluginExecutionException: Execution default-test of 
> goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test failed: 
> java.lang.RuntimeException: 
> 1,org.infinispan.persistence.leveldb.LevelDBStoreTest,testStoreAndRemove(org.infinispan.persistence.leveldb.LevelDBStoreTest),unit,null,null
> [11:17:10] :   [Step 2/4]     at 
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:143)
> [11:17:10] :   [Step 2/4]     at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
> [11:17:10] :   [Step 2/4]     ... 19 more
> [11:17:10] :   [Step 2/4] Caused by: java.lang.RuntimeException: 
> java.lang.RuntimeException: 
> 1,org.infinispan.persistence.leveldb.LevelDBStoreTest,testStoreAndRemove(org.infinispan.persistence.leveldb.LevelDBStoreTest),unit,null,null
> [11:17:10] :   [Step 2/4]     at 
> org.apache.maven.plugin.surefire.booterclient.output.ThreadedStreamConsumer.close(ThreadedStreamConsumer.java:123)
> [11:17:10] :   [Step 2/4]     at 
> org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:463)
> [11:17:10] :   [Step 2/4]     at 
> org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:352)
> [11:17:10] :   [Step 2/4]     at 
> org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:158)
> [11:17:10] :   [Step 2/4]     at 
> org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:967)
> [11:17:10] :   [Step 2/4]     at 
> org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:831)
> [11:17:10] :   [Step 2/4]     at 
> org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:729)
> [11:17:10] :   [Step 2/4]     at 
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
> [11:17:10] :   [Step 2/4]     ... 20 more
> [11:17:10] :   [Step 2/4] Caused by: java.lang.RuntimeException: 
> 1,org.infinispan.persistence.leveldb.LevelDBStoreTest,testStoreAndRemove(org.infinispan.persistence.leveldb.LevelDBStoreTest),unit,null,null
> [11:17:10] :   [Step 2/4]     at 
> org.apache.maven.plugin.surefire.booterclient.output.ForkClient.createReportEntry(ForkClient.java:209)
> [11:17:10] :   [Step 2/4]     at 
> org.apache.maven.plugin.surefire.booterclient.output.ForkClient.consumeLine(ForkClient.java:110)
> [11:17:10] :   [Step 2/4]     at 
> org.apache.maven.plugin.surefire.booterclient.output.ThreadedStreamConsumer$Pumper.run(ThreadedStreamConsumer.java:67)
> [11:17:10] :   [Step 2/4]     at java.lang.Thread.run(Thread.java:745)
> [11:17:10] :   [Step 2/4] Caused by: java.util.NoSuchElementException
> [11:17:10] :   [Step 2/4]     at 
> java.util.StringTokenizer.nextToken(StringTokenizer.java:349)
> [11:17:10] :   [Step 2/4]     at 
> org.apache.maven.plugin.surefire.booterclient.output.ForkClient.deserializeStackStraceWriter(ForkClient.java:217)
> [11:17:10] :   [Step 2/4]     at 
> org.apache.maven.plugin.surefire.booterclient.output.ForkClient.createReportEntry(ForkClient.java:202)
> [11:17:10] :   [Step 2/4]     ... 3 more
> {noformat}
> I believe this is caused by the native LevelDB library writing to stdout and 
> breaking the communication between {{ForkingRunListener}} and {{ForkClient}}. 
> It would be better if the communication between the main process and the fork 
> happened over a socket.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to