Skip to content

Reimplement signal handler to avoid async-unsafe functions#97

Closed
zzxuanyuan wants to merge 7 commits into
root-project:masterfrom
zzxuanyuan:sighandler
Closed

Reimplement signal handler to avoid async-unsafe functions#97
zzxuanyuan wants to merge 7 commits into
root-project:masterfrom
zzxuanyuan:sighandler

Conversation

@zzxuanyuan
Copy link
Copy Markdown
Contributor

@bbockelm @pcanal This patch copies the code of signal handling in CMSSW. It avoids async-unsafe functions in signal handler functions.

For reference, see the link https://github.com/bbockelm/cmssw/blob/stacktrace_handler_revisit/FWCore/Services/src/InitRootHandlers.cc

I tried this patch with some simple multi-thread test cases and it worked fine. Is there any complicated test cases I can run? I think this patch is not very ready to merge, but it achieved basic functions. Any criticisms are welcome.

Comment thread core/unix/inc/TUnixSystem.h Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need a forward dec'l if you already include

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And please use ROOT coding standards.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(by the way, is there a good online ref for these to link to?)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Philippe - Zhe, can you run through this guide and try to get the code to compliance?

@pcanal - when contributing to CVMFS, they provide an automated tool (based on cpplint). I see you reference astyle for managing whitespace. Do you have anything similarly automated you use?

@bbockelm
Copy link
Copy Markdown
Contributor

bbockelm commented Oct 7, 2015

Hi Zhe,

You may also want to pull in the work done here:

cms-sw/cmssw#11662

Specifically,
a) Allow the read function to timeout.
b) Avoid use of execv on Linux. CERN uses LD_PRELOAD tricks to insert a custom version of this function into the executable. Unlike the POSIX documentation, the version of execv at CERN is not async signal safe.

Brian

@zzxuanyuan
Copy link
Copy Markdown
Contributor Author

@bbockelm Sure. I will polish up my code.

@zzxuanyuan
Copy link
Copy Markdown
Contributor Author

Hi Philippe,

@pcanal Could you take a look at this new patch? Is there any test cases I can run with?

Thanks!

Comment thread core/unix/src/TUnixSystem.cxx Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since written is not used outside the loop, it ought to be declared inside.

@pcanal
Copy link
Copy Markdown
Member

pcanal commented Oct 19, 2015

Is there any test cases I can run with?

Not specifically. Some of the code would be exercised by calling ::Fatal( ... )

@pcanal
Copy link
Copy Markdown
Member

pcanal commented Dec 11, 2015

Hi,

What was the result of your testing? Did you create a test we can add to roottest?
Did you already update to follow the coding conventions? (I do not see an newer version so I commented on what I see)

Thanks,
Philippe.

Comment thread core/unix/inc/TUnixSystem.h Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Class not part of the public interface need to either be defined in an unnamed namepace in the source file or within the ROOT::Internal namespace or as protected/private subclass of the using class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants