tcdi / postgrestd

The most peculiar std you have ever seen
Other
37 stars 4 forks source link

Kill `std::panic::set_hook()` and `std::panic::take_hook()`? #27

Open eeeebbbbrrrr opened 1 year ago

eeeebbbbrrrr commented 1 year ago

It's unclear to me what those mean in the context of plrust, a pgx-based extension that installs its own panic handler, then dynamically loading a user function, also written in rust, that doesn't install its own language handler.

workingjubilee commented 1 year ago

That would break this code:

https://github.com/tcdi/pgx/blob/4b9467aebfd88c71cf0531b76cb524350ef0b698/pgx-pg-sys/src/submodules/panic.rs#L267-L271

eeeebbbbrrrr commented 1 year ago

That code isn't included in plrust user functions. Only in plrust proper

workingjubilee commented 1 year ago

...hmm. That makes me more worried about how this would work rather than less, but fair.

thomcc commented 1 year ago

That should be fine, the cdylib environment is entirely sealed off — it has it's own set of globals and everything. (The panic handler is using hidden symbols so they don't exist outside)