Skip to content
This repository was archived by the owner on Jun 30, 2025. It is now read-only.
This repository was archived by the owner on Jun 30, 2025. It is now read-only.

Is there any way logging without a mutex #504

@psionic12

Description

@psionic12

I got some special case here:
I got two threads both use glog, but one thread may be interrupted by signal, and there's a chance that I got error like this:

PC: @     0x7f0fdbfa9e97 gsignal
*** SIGABRT (@0x3e800000888) received by PID 2184 (TID 0x7f0fda3c9700) from PID 2184; stack trace: ***
    @     0x7f0fdc90f890 (unknown)
    @     0x7f0fdbfa9e97 gsignal
    @     0x7f0fdbfab801 abort
    @     0x55e900883539 glog_internal_namespace_::Mutex::Lock()
    @     0x55e900883626 glog_internal_namespace_::MutexLock::MutexLock()
    @     0x55e90087eefc google::LogMessage::Flush()
    @     0x55e90087ed6d google::LogMessage::~LogMessage()
    @     0x55e90086ed93 stop_handler()
    @     0x7f0fdc90f890 (unknown)
    @     0x7f0fdc07b187 __write
    @     0x7f0fdbff61bd _IO_file_write
    @     0x7f0fdbff6b2f _IO_file_xsputn
    @     0x7f0fdbfea977 fwrite
    @     0x55e90087c7b9 google::ColoredWriteToStderr()
    @     0x55e90087f282 google::LogMessage::SendToLog()
    @     0x55e90087ef77 google::LogMessage::Flush()
    @     0x55e90087ed6d google::LogMessage::~LogMessage()

I think this is caused by some mutex condition or some thing.

So any way I can logging without a mutex? And the consequences like ill format is acceptable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions