# H5Eset\_auto for all threads

**URL:** <https://forum.hdfgroup.org/t/h5eset-auto-for-all-threads/6305>\
**Category:** HDF5 Library\
**Created:** [October 23, 2019, 1:39pm UTC](https://forum.hdfgroup.org/t/h5eset-auto-for-all-threads/6305 "2019-10-23T13:39:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![thomas1](https://forum.hdfgroup.org/user_avatar/forum.hdfgroup.org/thomas1/32/1733_2.png) [@thomas1](https://forum.hdfgroup.org/u/thomas1)\
**Post date:** [October 23, 2019, 1:39pm UTC](https://forum.hdfgroup.org/t/h5eset-auto-for-all-threads/6305/1 "2019-10-23T13:39:26Z")

</div>

I’d like to resurrect a [topic from the distant past](https://forum.hdfgroup.org/t/h5eset-auto-for-all-threads/1501).

h5py currently calls `H5Eset_auto` before every call into libhdf5, to suppress the normal error-printing behaviour (HDF5 errors are turned into Python exceptions instead). For the most part, calling H5Eset\_auto once would work - except that each new thread starts with the default error-printing behaviour again. We want things to ‘just work’ with multiple threads as far as practical, so we silence the errors on every HDF5 call, just in case that’s the first one in a new thread.

What we’d really like is a function that can set the default error function for any new threads - maybe called `H5Eset_auto_default`. Then we could call this once, and avoid a tiny bit of work on each HDF5 function call.

In the mailing list thread 10 years ago, @koziol said they had created an issue for this. Is that issue still open? Is there any prospect of resolving it for HDF5 1.12?

---

<div class="post-metadata">

**Author:** ![steven](https://forum.hdfgroup.org/user_avatar/forum.hdfgroup.org/steven/32/117_2.png) [@steven](https://forum.hdfgroup.org/u/steven)\
**Post date:** [October 23, 2019, 2:06pm UTC](https://forum.hdfgroup.org/t/h5eset-auto-for-all-threads/6305/2 "2019-10-23T14:06:56Z")

</div>

I had similar problem when working on the c++ solution, which is to delegate the choice to the user with `h5::mute` and `h5::unmute`, then the systems [does exception handling the usual c++ way.](http://sandbox.h5cpp.org/architecture/#error-handling).

As a result, by default all HDF5 CAPI calls are printed out, and the software writer is responsible explicitly muting/unmuting them with `h5::mute | h5::unmute` . Because the C++ library is header only, there is no simple way to **intialize** default setting other than the python version does: calling a function multiple times, or introducing an additional thread local state.

Although the `mute | unmute` method seems to work fine in C++ world, I am interested in solutions that make life easier without trade offs regarding performance.

---

<div class="post-metadata">

**Author:** ![thomas1](https://forum.hdfgroup.org/user_avatar/forum.hdfgroup.org/thomas1/32/1733_2.png) [@thomas1](https://forum.hdfgroup.org/u/thomas1)\
**Post date:** [October 23, 2019, 2:25pm UTC](https://forum.hdfgroup.org/t/h5eset-auto-for-all-threads/6305/3 "2019-10-23T14:25:22Z")

</div>

h5py similarly has `silence_errors` and `unsilence_errors` to disable & enable the HDF5 built in error printing. But it tries to silence them by default, and `unsilence_errors` has been broken for some time (probably years), because they would effectively be silenced again before each call.
