trifork / erjang

A JVM-based Erlang VM
http://www.erjang.org
Apache License 2.0
726 stars 62 forks source link

New halt/shutdown code sometimes breaks #59

Closed krestenkrab closed 13 years ago

krestenkrab commented 13 years ago

Since enabling the new shutdown code, when doing erlang:halt() from the shell, it will spew ugly error messages. Also, hitting ^D (EOF) will make the shell restart for ever.

It may (and may not) be directly related to the refactoring done in this commit https://github.com/trifork/erjang/commit/b5147c8b0ded2a81ac73791177deb5c056dd23c9

jetztgradnet commented 13 years ago

This is surely related to my shutdown cleanup, as System.exit() is no longer called, which may have hidden the underlying problem. I'll look into this.

jetztgradnet commented 13 years ago

For reference, the error message is:

Eshell V5.8.2  (abort with ^G)
1> erlang:halt().
22.09.2011 08:05:05 erjang.m.erlang.ErlProc halt
INFO: halting system
22.09.2011 08:05:05 erjang.EProc execute
SCHWERWIEGEND: [java] exiting <0.0.505> with: 
java.lang.NullPointerException
    at erjang.EList.<init>(EList.java:36)
    at erjang.EList.cons(EList.java:53)
    at erjang.EList.cons(EList.java:27)
    at erjang.ESeq.fromArray(ESeq.java:70)
    at erjang.EModuleManager$FunctionInfo$1.invoke(EModuleManager.java:176)
    at erjang.EFunio_lib_prettyprintHandler6.go(Unknown Source)
    at erjang.m.shell.shell.pp__3$call(shell.S)
    at erjang.m.shell.shell.exprs__7(shell.S:259)
    at erjang.m.shell.shell$FN_exprs__7.go(Unknown Source)
    at erjang.m.shell.shell.exprs__6$call(shell.S)
    at erjang.m.shell.shell.eval_exprs__7(shell.S:242)
    at erjang.m.shell.shell.eval_loop__3(shell.S:232)
    at erjang.m.shell.shell$FN_eval_loop__3.go(Unknown Source)
    at erjang.m.erlang.ErlBif.apply(ErlBif.java:123)
    at erjang.m.erlang.ErlBif$FN_apply__2.go(Unknown Source)
    at erjang.EProc.execute(EProc.java:424)
    at kilim.Task._runExecute(Task.java:403)
    at kilim.WorkerThread.run(WorkerThread.java:47)
22.09.2011 08:05:05 erjang.EModuleManager$FunctionInfo$1 invoke
INFO: MISSING kernel:prep_stop/1
** exception exit: {java_exception,"java.lang.NullPointerException\n\tat erjang.EList.<init>(EList.java:36)\n\tat erjang.EList.cons(EList.java:53)\n\tat erjang.EList.cons(EList.java:27)\n\tat erjang.ESeq.fromArray(ESeq.java:70)\n\tat erjang.EModuleManager$FunctionInfo$1.invoke(EModuleManager.java:176)\n\tat erjang.EFunio_lib_prettyprintHandler6.go(Unknown Source)\n\tat erjang.m.shell.shell.pp__3$call(shell.S)\n\tat erjang.m.shell.shell.exprs__7(shell.S:259)\n\tat erjang.m.shell.shell$FN_exprs__7.go(Unknown Source)\n\tat erjang.m.shell.shell.exprs__6$call(shell.S)\n\tat erjang.m.shell.shell.eval_exprs__7(shell.S:242)\n\tat erjang.m.shell.shell.eval_loop__3(shell.S:232)\n\tat erjang.m.shell.shell$FN_eval_loop__3.go(Unknown Source)\n\tat erjang.m.erlang.ErlBif.apply(ErlBif.java:123)\n\tat erjang.m.erlang.ErlBif$FN_apply__2.go(Unknown Source)\n\tat erjang.EProc.execute(EProc.java:424)\n\tat kilim.Task._runExecute(Task.java:403)\n\tat kilim.WorkerThread.run(WorkerThread.java:47)\n"}
     in function  shell:exprs/7
     in call from shell:eval_exprs/7
     in call from shell:eval_loop/3
     in call from erlang:apply/4
2> 22.09.2011 08:05:07 erjang.m.erlang.ErlProc halt
INFO: halting system
done.
krestenkrab commented 13 years ago

Ah, ErlProc.java#halt/2 returns null! So that's pretty obvious; null is never to escape out into beam-compiled code. The question is why it even terminates; shouldn't it be thowing some kind of exception in stead?