Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

possible deadlock in ddout.c #47

Open
4 tasks
wehimwich opened this issue May 22, 2020 · 0 comments
Open
4 tasks

possible deadlock in ddout.c #47

wehimwich opened this issue May 22, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@wehimwich
Copy link
Member

While investigating #22, it became clear that the output display and logging for the TNX command uses logit(), creating a risk of a possible deadlock.

Background: The TNX functionality was added in 08249d9 (2001 Feb). In 54af15c (2016 Jul), ddout was fixed to not use class I/O with fserr, sterp, and erchk to eliminate the risk of a deadlock in high log entry volume situations, like multicast logging. However TNX use of logit() and reporting error bo -999 (also usinglogit())were apparently overlooked; they are still vulnerable to this. Probably only cls_snd() was looked for.

Still, the chance of a deadlock is pretty low. It could probably only happen in a high volume situation (active multicast logging) if the operator either uses TNX or changes to an existing log file big enough to cause a warning about its size (bo -999). Even then it is probably unlikely that the class I/O system would be at maximum capacity.

It looks like the most straightforward way to fix this in ddout.c is probably:

  • make a C version of logen.f to format the log entry, only a subset is needed; it is probably easiest to start with logit.c, use of which would be replaced for this purpose
  • add a C function to output the entry to the screen and the log; only a subset of the full, ddout functionality is needed; the same error checking/reporting for the disk writing is needed; these two C functions might be combined into one
  • use a a direct log entry error message approach, like with logite.c, to format errors and then output, both accomplished using the above C function(s) in place of logit()
  • change these errors in fserr.ctl to be placeholders ('this is a place holder for an error in ddout.c') to avoid accidental reuse

The particular bo errors reported by ddout would probably forego being filtered by TNX and sent to sterp and erchk, but with more code rearrange probably could be fully supported.

@wehimwich wehimwich added the bug Something isn't working label May 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant