PaesslerAG / gval

Expression evaluation in golang
BSD 3-Clause "New" or "Revised" License
713 stars 83 forks source link

functions inside expression are evaluated in coroutine and on panic are not recovered thus crashing whole application #79

Closed aldas closed 1 year ago

aldas commented 2 years ago

functions inside expressions are evaluated in coroutine and on panic are not recovered thus crashing whole application. I think there should be somekind of recover as when coroutine ends with not recovered panic the whole application gets shutdown by go runtime.

https://github.com/PaesslerAG/gval/blob/12d4df2a647a3a5cf5be4fc40872f64d01e36f76/functions.go#L16 and https://github.com/PaesslerAG/gval/blob/12d4df2a647a3a5cf5be4fc40872f64d01e36f76/functions.go#L39

note: why it is done in coroutine? from timeout or context cancellation perspective this makes little sense because if there is endless loop returning from expression that "timeouted" makes little difference because that endless coroutine still works on background.