Skip to content
This repository has been archived by the owner on Jan 9, 2024. It is now read-only.

Segmentation fault in unit test due to SILKRPC_LOG trace #213

Open
canepat opened this issue Jan 5, 2022 · 1 comment
Open

Segmentation fault in unit test due to SILKRPC_LOG trace #213

canepat opened this issue Jan 5, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@canepat
Copy link
Member

canepat commented Jan 5, 2022

Adding one or more SILKRPC_LOG traces causes the unit test executable to crash with segmentation fault

Probably it's something related to logging streams, please @Sixtysixter provide more info here when available

@canepat canepat added the bug Something isn't working label Jan 5, 2022
@Sixtysixter
Copy link
Collaborator

Sixtysixter commented Jan 12, 2022

The log instance responsible for logging is teestream, instantiated by default with std::cerr stream and a null stream (see https://github.com/torquem-ch/silkrpc/blob/ee585804b3d8a7916b6ea8df01ea08a3b662d047/silkrpc/common/log.cpp#L33 ).
The internal pointers to std::streambuf are initialized calling rdbuf() on
The rdbuf() call on std:cerr, used in this way, returns a pointer that seem bad (at 0x7ffff....).
This cause the segmentation violation fail (both with gcc and clang).
It is need to add
SILKRPC_LOG_STREAMS(null_stream(), null_stream());
to properly set the log instance.
Note that the crash happens if the tested code contains some trace allowed by the verbosity level (ie SILKRPC_LOG) so set the verbosity to NONE is not enough (by default it is set to INFO)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants