You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by "smalljunHw (via GitHub)" <gi...@apache.org> on 2023/08/28 02:52:47 UTC

[GitHub] [servicecomb-java-chassis] smalljunHw opened a new issue, #3918: BootListener监听AFTER_REGISTRY事件抛异常时,不会启动失败,也会导致后续的监听此事件的listener不执行

smalljunHw opened a new issue, #3918:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3918

   如题,我们碰到有些业务需要在启动过程中需要调用别的CSE微服务来做一些初始化的工作,这个时候需要监听AFTER_REGISTRY事件,但是自定义的BootListener在监听AFTER_REGISTRY事件如果抛异常,会有2个问题
   1)不会像别的监听事件一样,listener抛异常会让启动失败;
   2)会造成后续监听此事件的listener不执行
   最后,仅是打一行日志。
   从实现看,是因为微服务实例注册事件是在Service Center线程执行的,而不是在main线程,故listener抛异常不会导致启动失败。


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] BootListener监听AFTER_REGISTRY事件抛异常时,不会启动失败,也会导致后续的监听此事件的listener不执行 [servicecomb-java-chassis]

Posted by "liubao68 (via GitHub)" <gi...@apache.org>.
liubao68 commented on issue #3918:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3918#issuecomment-1783750205

   > 这个问题,能够让业务能够感知这一异常,从而做一些告警相关的事情?
   
   业务自己的实现抛出异常, 自己捕获去处理应该就可以了吧。 额外框架增加告警扩展感觉有点过度设计了 。 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] BootListener监听AFTER_REGISTRY事件抛异常时,不会启动失败,也会导致后续的监听此事件的listener不执行 [servicecomb-java-chassis]

Posted by "smalljunHw (via GitHub)" <gi...@apache.org>.
smalljunHw commented on issue #3918:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3918#issuecomment-1783740581

   > 我在2.6.0版本实现了一个listener,监听AFTER_REGISTRY,监听到该事件,执行一些逻辑后,抛出异常会导致服务进程挂掉
   你可以先让注册中心连不上,待启动流程完成后,再让注册中心恢复,此时监听AFTER_REGISTRY事件的BootListener就会在心跳线程中执行,抛异常不会导致进程挂掉。
   因为CSE先在main线程的启动流程中尝试向注册中心注册微服务实例,如果启动流程中注册成功了,那AFTER_REGISTRY事件的BootListener就在main线程执行,如果抛异常会导致启动失败;如果启动流程中微服务实例未注册成功,则会在心跳线程中继续尝试进行微服务实例注册,AFTER_REGISTRY事件的BootListener也在这个线程中执行,如果抛异常,不会导致启动失败,会产生所说的问题


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] BootListener监听AFTER_REGISTRY事件抛异常时,不会启动失败,也会导致后续的监听此事件的listener不执行 [servicecomb-java-chassis]

Posted by "liubao68 (via GitHub)" <gi...@apache.org>.
liubao68 closed issue #3918: BootListener监听AFTER_REGISTRY事件抛异常时,不会启动失败,也会导致后续的监听此事件的listener不执行
URL: https://github.com/apache/servicecomb-java-chassis/issues/3918


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] BootListener监听AFTER_REGISTRY事件抛异常时,不会启动失败,也会导致后续的监听此事件的listener不执行 [servicecomb-java-chassis]

Posted by "liubao68 (via GitHub)" <gi...@apache.org>.
liubao68 commented on issue #3918:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3918#issuecomment-1786342332

   关于这个问题: 3.0.0将注册修改为同步注册了,也就是说启动过程中如果注册不成功, 那么启动会失败。 启动成功后处理AFTER_REGISTRY事件,如果处理失败, 启动会失败。 
   
   大家觉得2.0.0也修改为同步注册如何? 上述问题能解了。 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [servicecomb-java-chassis] yanghao605 commented on issue #3918: BootListener监听AFTER_REGISTRY事件抛异常时,不会启动失败,也会导致后续的监听此事件的listener不执行

Posted by "yanghao605 (via GitHub)" <gi...@apache.org>.
yanghao605 commented on issue #3918:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3918#issuecomment-1733547101

   > `java chassis被设计为注册失败,进程不退出,一直尝试注册` 这个规则在2.8.x不能修改了。 3.0.0会调整这个逻辑。
   
   注册失败,进程不退出,这个逻辑是合理的吧,有的业务是spring的rest和java-chassis并存的,就算注册失败了,服务进程正常启动,这样子不会影响通过域名或者ip的调用


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #3918: BootListener监听AFTER_REGISTRY事件抛异常时,不会启动失败,也会导致后续的监听此事件的listener不执行

Posted by "liubao68 (via GitHub)" <gi...@apache.org>.
liubao68 commented on issue #3918:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3918#issuecomment-1729369330

   你期望一个什么样的结果了?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [servicecomb-java-chassis] kelseysunhaha commented on issue #3918: BootListener监听AFTER_REGISTRY事件抛异常时,不会启动失败,也会导致后续的监听此事件的listener不执行

Posted by "kelseysunhaha (via GitHub)" <gi...@apache.org>.
kelseysunhaha commented on issue #3918:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3918#issuecomment-1705902626

   uiuiuii
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] BootListener监听AFTER_REGISTRY事件抛异常时,不会启动失败,也会导致后续的监听此事件的listener不执行 [servicecomb-java-chassis]

Posted by "smalljunHw (via GitHub)" <gi...@apache.org>.
smalljunHw commented on issue #3918:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3918#issuecomment-1783740849

   这个问题,能够让业务能够感知这一异常,从而做一些告警相关的事情?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] BootListener监听AFTER_REGISTRY事件抛异常时,不会启动失败,也会导致后续的监听此事件的listener不执行 [servicecomb-java-chassis]

Posted by "smalljunHw (via GitHub)" <gi...@apache.org>.
smalljunHw commented on issue #3918:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3918#issuecomment-1751930846

   > 你期望一个什么样的结果了?
   > 
   > `1)不会像别的监听事件一样,listener抛异常会让启动失败` 是的, 因为java chassis被设计为注册失败,进程不退出,一直尝试注册,直到成功。
   > 
   > `2)会造成后续监听此事件的listener不执行` 这个怎么理解? AFTER_REGISTRY 事件一般只会触发一次。
   > 
   > 所以总的来讲,这种场景应用最好捕获异常。如果必须应用失败,可以在之前做一些前提条件检查,保证AFTER_REGISTRY的逻辑不至于失败。
   
   如果有2个listener A和B,监听AFTER_REGISTRY事件时,如果A抛了异常,B就不会执行


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [servicecomb-java-chassis] liubao68 closed issue #3918: BootListener监听AFTER_REGISTRY事件抛异常时,不会启动失败,也会导致后续的监听此事件的listener不执行

Posted by "liubao68 (via GitHub)" <gi...@apache.org>.
liubao68 closed issue #3918: BootListener监听AFTER_REGISTRY事件抛异常时,不会启动失败,也会导致后续的监听此事件的listener不执行
URL: https://github.com/apache/servicecomb-java-chassis/issues/3918


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [servicecomb-java-chassis] yanghao605 commented on issue #3918: BootListener监听AFTER_REGISTRY事件抛异常时,不会启动失败,也会导致后续的监听此事件的listener不执行

Posted by "yanghao605 (via GitHub)" <gi...@apache.org>.
yanghao605 commented on issue #3918:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3918#issuecomment-1733541198

   我在2.6.0版本实现了一个listener,监听AFTER_REGISTRY,监听到该事件,执行一些逻辑后,抛出异常会导致服务进程挂掉


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] BootListener监听AFTER_REGISTRY事件抛异常时,不会启动失败,也会导致后续的监听此事件的listener不执行 [servicecomb-java-chassis]

Posted by "liubao68 (via GitHub)" <gi...@apache.org>.
liubao68 commented on issue #3918:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3918#issuecomment-1786395721

   2.x暂不修复涉及行为变化的问题。 3.0.0已经修改这个问题。 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #3918: BootListener监听AFTER_REGISTRY事件抛异常时,不会启动失败,也会导致后续的监听此事件的listener不执行

Posted by "liubao68 (via GitHub)" <gi...@apache.org>.
liubao68 commented on issue #3918:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3918#issuecomment-1729382491

   `java chassis被设计为注册失败,进程不退出,一直尝试注册` 这个规则在2.8.x不能修改了。 3.0.0会调整这个逻辑。 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [servicecomb-java-chassis] kelseysunhaha commented on issue #3918: BootListener监听AFTER_REGISTRY事件抛异常时,不会启动失败,也会导致后续的监听此事件的listener不执行

Posted by "kelseysunhaha (via GitHub)" <gi...@apache.org>.
kelseysunhaha commented on issue #3918:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3918#issuecomment-1705909981

   > 如题,我们碰到有些业务需要在启动过程中需要调用别的CSE微服务来做一些初始化的工作,这个时候需要监听AFTER_REGISTRY事件,但是自定义的BootListener在监听AFTER_REGISTRY事件如果抛异常,会有2个问题 1)不会像别的监听事件一样,listener抛异常会让启动失败 2)会造成后续监听此事件的listener不执行 最后,仅是打些报错日志。 从实现看,是因为微服务实例注册事件是在Service Center线程执行的,而不是在main线程,故listener抛异常不会导致启动失败。
   
   对有道理


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [servicecomb-java-chassis] kelseysunhaha commented on issue #3918: BootListener监听AFTER_REGISTRY事件抛异常时,不会启动失败,也会导致后续的监听此事件的listener不执行

Posted by "kelseysunhaha (via GitHub)" <gi...@apache.org>.
kelseysunhaha commented on issue #3918:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3918#issuecomment-1706305791

   > 如题,我们碰到有些业务需要在启动过程中需要调用别的CSE微服务来做一些初始化的工作,这个时候需要监听AFTER_REGISTRY事件,但是自定义的BootListener在监听AFTER_REGISTRY事件如果抛异常,会有2个问题 1)不会像别的监听事件一样,listener抛异常会让启动失败 2)会造成后续监听此事件的listener不执行 最后,仅是打些报错日志。 从实现看,是因为微服务实例注册事件是在Service Center线程执行的,而不是在main线程,故listener抛异常不会导致启动失败。
   
   
   
   > > 如题,我们碰到有些业务需要在启动过程中需要调用别的CSE微服务来做一些初始化的工作,这个时候需要监听AFTER_REGISTRY事件,但是自定义的BootListener在监听AFTER_REGISTRY事件如果抛异常,会有2个问题 1)不会像别的监听事件一样,listener抛异常会让启动失败 2)会造成后续监听此事件的listener不执行 最后,仅是打些报错日志。 从实现看,是因为微服务实例注册事件是在Service Center线程执行的,而不是在main线程,故listener抛异常不会导致启动失败。
   > 
   > 对有道理说的非常正确
   
   一个问题回复


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org