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

ASF GitHub Bot commented on STORM-183:
--------------------------------------

Github user revans2 commented on a diff in the pull request:

    https://github.com/apache/incubator-storm/pull/139#discussion_r13765591
  
    --- Diff: storm-core/src/clj/backtype/storm/daemon/worker.clj ---
    @@ -448,4 +448,6 @@
     (defn -main [storm-id assignment-id port-str worker-id]  
       (let [conf (read-storm-config)]
         (validate-distributed-mode! conf)
    -    (mk-worker conf nil storm-id assignment-id (Integer/parseInt port-str) 
worker-id)))
    +    (.addShutdownHook (Runtime/getRuntime)
    --- End diff --
    
    I'm not sure that this shutdown hook will be called in all cases.  Most 
places the worker code calls Runtime.halt on error, which does not call any of 
the shutdown hooks.  It just exits.  I think that was done because shutdown 
hooks can lock up, and if they do the process does not exit.  So we could get 
zombie processes.  Typically I have seen this addressed by installing a 
shutdown hook that will let the other shutdown hooks run for a maximum amount 
of time, at which point it calls Runtime.halt.


> Supervisor/worker shutdown hook should be called in distributed mode.
> ---------------------------------------------------------------------
>
>                 Key: STORM-183
>                 URL: https://issues.apache.org/jira/browse/STORM-183
>             Project: Apache Storm (Incubating)
>          Issue Type: Bug
>            Reporter: caofangkun
>            Priority: Minor
>         Attachments: STORM-183-1.patch
>
>
> if the process is killed forcefully from the OS or if it's crashing due to 
> resource issues (e.g., out of memory), shutdown hooks won't be invoked.
> -TERM (15) 
> The process is requested to stop running; it should try to exit cleanly 
> -KILL (9) 
> The process will be killed by the kernel; this signal cannot be ignored.
> So should we better use 'kill -15' ?
> See:
> https://github.com/apache/incubator-storm/blob/master/storm-core/src/clj/backtype/storm/util.clj#L392
> https://github.com/apache/incubator-storm/blob/master/storm-core/src/clj/backtype/storm/daemon/supervisor.clj#L175
> will never be called for supervisor:
> https://github.com/apache/incubator-storm/blob/master/storm-core/src/clj/backtype/storm/daemon/supervisor.clj#L396
> will never be called for worker:
> https://github.com/apache/incubator-storm/blob/master/storm-core/src/clj/backtype/storm/daemon/worker.clj#L421
> We'd better add something like :
> (.addShutdownHook (Runtime/getRuntime) (Thread. (fn [] (.shutdown mk-sv)))))) 
>  ?



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to