Re: [sbt] Forked builds and System.exit

Showing 1-3 of 3 messages
Re: [sbt] Forked builds and System.exit Kevin Scaldeferri 10/9/12 11:04 AM
I would also either like SBT to do this, or to provide a mechanism to do it.  I recently discovered this issue using the testNG plugin (testNG had a thread leak, now fixed in HEAD but not released) and it was quite frustrating to track down the cause.  And, I still haven't sorted out a workaround to terminate the forked process.

-kevin


On Mon, Oct 8, 2012 at 7:36 PM, James Roper <jro...@gmail.com> wrote:
I'm seeing inconsistent behaviour between forked tasks and the main build.  This is a similar, but different situation to in this thread:


My tests are leaking threads.  This isn't a good thing.  But everything works fine when I run the tests normally.  However, if I run the tests in forked mode, the forked process hangs.

Now in the previous thread many people argued that SBT shouldn't be responsible for cleaning threads, I'm not going to argue for what SBT should or shouldn't do, I want to argue for consistent behaviour.

So the SBT code is definitely designed to, in the main process, always call System.exit after the main thread finishes, unless something has explicitly told it not to through returning an xsbti.Continue result.  If you're not convinced, read Boot.scala and Launch.scala for yourself.  However the forked processes don't ever call System.exit.  This leads to developers encountering this problem, like I did, and scratching their heads.  It also makes debugging the problem harder, since I can't just attach a debugger to the main SBT process, do some things with the debugger to change some state on the JVM, and then see if it shuts down properly, because it always will.

So would people agree in this instance that if SBT is calling System.exit after its main thread exits, so should forked processes?  Could this be a configuration option?

--
You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
To view this discussion on the web visit https://groups.google.com/d/msg/simple-build-tool/-/vEkHcISMBhAJ.
To post to this group, send email to simple-b...@googlegroups.com.
To unsubscribe from this group, send email to simple-build-t...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/simple-build-tool?hl=en.

Re: Forked builds and System.exit phausel 10/9/12 11:35 AM
FYI I opened a ticket for this: https://github.com/harrah/xsbt/issues/565
Re: [sbt] Re: Forked builds and System.exit Kevin Scaldeferri 10/17/12 2:23 PM
I'm happy to see this was quickly patched on the 0.13 branch, and perhaps it will get backported for 0.12.2, but in the meantime, can anyone suggest a workaround to force my forked tests to exit?

Thanks,
Kevin


--
You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
To view this discussion on the web visit https://groups.google.com/d/msg/simple-build-tool/-/1O4QxGyed0gJ.

To post to this group, send email to simple-b...@googlegroups.com.
To unsubscribe from this group, send email to simple-build-t...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/simple-build-tool?hl=en.