Skip to content

[Question]: About what happens when panic occurred inside a worker #364

@vvakame

Description

@vvakame

Questions with details

Hi! My team uses ants a lot. Thanks for a great product!

Document of Options.PanicHandler said below 1

if nil, panics will be thrown out again from worker goroutines.

In the actual implementation, if PanicHandler is nil, it appears to be suppressed after logging output. 2

If I want to detect a panic (or propagate panic to main process) after Invoke called, should I use WithPanicHandler with own implementations?

Code snippets (optional)

Footnotes

  1. https://github.com/panjf2000/ants/blob/a44594205e16818434d27f02da3f81c26e51a74a/options.go#L57-L58

  2. https://github.com/panjf2000/ants/blob/a44594205e16818434d27f02da3f81c26e51a74a/worker_func.go#L62

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is neededquestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions