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

Cannot Start or Stop Units anymore, when nothing reads from the job completion channel #429

Open
j-licht opened this issue Oct 12, 2023 · 0 comments

Comments

@j-licht
Copy link

j-licht commented Oct 12, 2023

out <- result

The jobHandler used e.g. by Conn.StartUnitContext blocks for ever if nothing reads from the provided channel.
I think this write to the result channel should be non-blocking, like this:

	c.jobListener.Lock()
	out, ok := c.jobListener.jobs[job]
	if ok {
		select {
		case out <- result:
		default:
			fmt.Println("failed to write result to job channel")
		}
		delete(c.jobListener.jobs, job)
	}
	c.jobListener.Unlock()

I'm not sure, what is the best way to log something or if it's even necessary,

j-licht added a commit to j-licht/go-systemd that referenced this issue Oct 13, 2023
When handling the jobComplete signal, only try to write to the channel
and do not block on the channel write. If nothing reads from this
channel, the function blocks forever and makes it impossible to start
new jobs.

Fixes coreos#429
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

No branches or pull requests

1 participant