You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Christopher Mosher (JIRA)" <ji...@codehaus.org> on 2012/08/17 16:09:21 UTC

[jira] (SUREFIRE-906) Sometimes get NullPointerException in forked process

Christopher Mosher created SUREFIRE-906:
-------------------------------------------

             Summary: Sometimes get NullPointerException in forked process
                 Key: SUREFIRE-906
                 URL: https://jira.codehaus.org/browse/SUREFIRE-906
             Project: Maven Surefire
          Issue Type: Bug
          Components: process forking
    Affects Versions: 2.13.0
         Environment: Arch linux
            Reporter: Christopher Mosher


(This is using the latest 2.13-SNAPSHOT)

Using forkMode=perthread, the child processes sometimes abort with this exception:

java.lang.NullPointerException
	at java.io.File.<init>(File.java:251)
	at org.apache.maven.surefire.booter.BooterDeserializer.deserialize(BooterDeserializer.java:61)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:63)

It only happens sometimes.
Using -X keeps the temp files, and looking at the file that's supposed to pass the properties, I see that the file is truncated midway, causing the exception.

Possibly the parent process needs to *flush* the file after it writes to it before is closes it.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (SUREFIRE-906) Sometimes get NullPointerException in forked process

Posted by "Christopher Mosher (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/SUREFIRE-906?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=306445#comment-306445 ] 

Christopher Mosher commented on SUREFIRE-906:
---------------------------------------------

Maybe out.getFD().sync() ?
                
> Sometimes get NullPointerException in forked process
> ----------------------------------------------------
>
>                 Key: SUREFIRE-906
>                 URL: https://jira.codehaus.org/browse/SUREFIRE-906
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: process forking
>    Affects Versions: 2.13.0
>         Environment: Arch linux
>            Reporter: Christopher Mosher
>
> (This is using the latest 2.13-SNAPSHOT)
> Using forkMode=perthread, the child processes sometimes abort with this exception:
> java.lang.NullPointerException
> 	at java.io.File.<init>(File.java:251)
> 	at org.apache.maven.surefire.booter.BooterDeserializer.deserialize(BooterDeserializer.java:61)
> 	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:63)
> It only happens sometimes.
> Using -X keeps the temp files, and looking at the file that's supposed to pass the properties, I see that the file is truncated midway, causing the exception.
> Possibly the parent process needs to *flush* the file after it writes to it before is closes it.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (SUREFIRE-906) Sometimes get NullPointerException in forked process

Posted by "Kristian Rosenvold (JIRA)" <ji...@codehaus.org>.
     [ https://jira.codehaus.org/browse/SUREFIRE-906?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kristian Rosenvold closed SUREFIRE-906.
---------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.13.0
         Assignee: Kristian Rosenvold

Fixed with a slightly different patch in r1374556, thanks for testing the solution.


                
> Sometimes get NullPointerException in forked process
> ----------------------------------------------------
>
>                 Key: SUREFIRE-906
>                 URL: https://jira.codehaus.org/browse/SUREFIRE-906
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: process forking
>    Affects Versions: 2.13.0
>         Environment: Arch linux
>            Reporter: Christopher Mosher
>            Assignee: Kristian Rosenvold
>             Fix For: 2.13.0
>
>         Attachments: SUREFIRE-906-0001.patch
>
>
> (This is using the latest 2.13-SNAPSHOT)
> Using forkMode=perthread, the child processes sometimes abort with this exception:
> java.lang.NullPointerException
> 	at java.io.File.<init>(File.java:251)
> 	at org.apache.maven.surefire.booter.BooterDeserializer.deserialize(BooterDeserializer.java:61)
> 	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:63)
> It only happens sometimes.
> Using -X keeps the temp files, and looking at the file that's supposed to pass the properties, I see that the file is truncated midway, causing the exception.
> Possibly the parent process needs to *flush* the file after it writes to it before is closes it.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (SUREFIRE-906) Sometimes get NullPointerException in forked process

Posted by "Kristian Rosenvold (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/SUREFIRE-906?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=306442#comment-306442 ] 

Kristian Rosenvold commented on SUREFIRE-906:
---------------------------------------------

Interesting how the "flush" method on FileOutputStream does nothign....
                
> Sometimes get NullPointerException in forked process
> ----------------------------------------------------
>
>                 Key: SUREFIRE-906
>                 URL: https://jira.codehaus.org/browse/SUREFIRE-906
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: process forking
>    Affects Versions: 2.13.0
>         Environment: Arch linux
>            Reporter: Christopher Mosher
>
> (This is using the latest 2.13-SNAPSHOT)
> Using forkMode=perthread, the child processes sometimes abort with this exception:
> java.lang.NullPointerException
> 	at java.io.File.<init>(File.java:251)
> 	at org.apache.maven.surefire.booter.BooterDeserializer.deserialize(BooterDeserializer.java:61)
> 	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:63)
> It only happens sometimes.
> Using -X keeps the temp files, and looking at the file that's supposed to pass the properties, I see that the file is truncated midway, causing the exception.
> Possibly the parent process needs to *flush* the file after it writes to it before is closes it.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (SUREFIRE-906) Sometimes get NullPointerException in forked process

Posted by "Christopher Mosher (JIRA)" <ji...@codehaus.org>.
     [ https://jira.codehaus.org/browse/SUREFIRE-906?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christopher Mosher updated SUREFIRE-906:
----------------------------------------

    Attachment: SUREFIRE-906-0001.patch

I was able to fix it with the attached patch. It did not have to do with the output files. Instead it was a non-thread-safe issue with the properties object. Multiple threads in the parent (forking) process were accessing the same properties... the clone() call that was there must not have been enough to ensure thread safety.
                
> Sometimes get NullPointerException in forked process
> ----------------------------------------------------
>
>                 Key: SUREFIRE-906
>                 URL: https://jira.codehaus.org/browse/SUREFIRE-906
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: process forking
>    Affects Versions: 2.13.0
>         Environment: Arch linux
>            Reporter: Christopher Mosher
>         Attachments: SUREFIRE-906-0001.patch
>
>
> (This is using the latest 2.13-SNAPSHOT)
> Using forkMode=perthread, the child processes sometimes abort with this exception:
> java.lang.NullPointerException
> 	at java.io.File.<init>(File.java:251)
> 	at org.apache.maven.surefire.booter.BooterDeserializer.deserialize(BooterDeserializer.java:61)
> 	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:63)
> It only happens sometimes.
> Using -X keeps the temp files, and looking at the file that's supposed to pass the properties, I see that the file is truncated midway, causing the exception.
> Possibly the parent process needs to *flush* the file after it writes to it before is closes it.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (SUREFIRE-906) Sometimes get NullPointerException in forked process

Posted by "Christopher Mosher (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/SUREFIRE-906?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=306470#comment-306470 ] 

Christopher Mosher commented on SUREFIRE-906:
---------------------------------------------

Your fix is confirmed. Thanks for your quick response, Kristian.
Note that the revision is actually r1374456.
                
> Sometimes get NullPointerException in forked process
> ----------------------------------------------------
>
>                 Key: SUREFIRE-906
>                 URL: https://jira.codehaus.org/browse/SUREFIRE-906
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: process forking
>    Affects Versions: 2.13.0
>         Environment: Arch linux
>            Reporter: Christopher Mosher
>            Assignee: Kristian Rosenvold
>             Fix For: 2.13.0
>
>         Attachments: SUREFIRE-906-0001.patch
>
>
> (This is using the latest 2.13-SNAPSHOT)
> Using forkMode=perthread, the child processes sometimes abort with this exception:
> java.lang.NullPointerException
> 	at java.io.File.<init>(File.java:251)
> 	at org.apache.maven.surefire.booter.BooterDeserializer.deserialize(BooterDeserializer.java:61)
> 	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:63)
> It only happens sometimes.
> Using -X keeps the temp files, and looking at the file that's supposed to pass the properties, I see that the file is truncated midway, causing the exception.
> Possibly the parent process needs to *flush* the file after it writes to it before is closes it.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira