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

Pacman Block fakeroot disposal #30

Closed
greshake opened this issue May 28, 2017 · 11 comments
Closed

Pacman Block fakeroot disposal #30

greshake opened this issue May 28, 2017 · 11 comments

Comments

@greshake
Copy link
Owner

@keeslinp : The pacman block clearly still has issues with cleaning up after updates. This is a screenshot of the process hierarchie after running for like 2h:

2017-05-28-10 17 00

@keeslinp
Copy link
Contributor

Hmm, that's really strange. I took a look at it yesterday but for some reason the project wasn't​ building for me after recent changes. I'm gonna take a better look at it soon. I wonder if there's something you're supposed to call after spawn(). A new compiler warning popped up that complained about a return value not being used after spawn. I suspect that's relevant.

@greshake
Copy link
Owner Author

I really don't have time to help you a whole lot right now, but spawn() returns a handle to the child process and doesn't block until it's finished. You should use the handle to ensure all child processes are killed in the end. Also, try to update in a separate thread, that way other block updates don't stall until you've updated the package db. Actually, any update which queries network or does some other huge operation should be executed separately. Should have documented this and told you earlier, sorry about that, but I'm to my neck in other tasks right now. Look at the pending PR for the weather block; the guy did exactly that (his code is very nice). Use an Arc<Mutex> to send data between your update thread and the main thread.

@greshake
Copy link
Owner Author

Oh, and no idea why it wasn't building, I tried paying attention not to push broken changes. Just checked and master is building fine, except for a couple warnings.

@keeslinp
Copy link
Contributor

Thanks for the suggestion :). I don't know what was wrong either, I was getting some errors about missing things. I ended up just removing and recloning the repo and all was well. I'll make the changes you suggested.

pitkley added a commit to pitkley/i3status-rust that referenced this issue Jun 5, 2017
Calling out to a shell is not necessary for a bulk of the commands in
`get_update_count`, it probably is bad practice to do so. This commit
cleans `get_update_count` up and removes most of the shell-calls.

In addition, `run_command` has been changed to wait for the executed
commands to exit. `Command::spawn` will spawn the processes without
blocking, i.e. the program will continue with it's normal execution
immediately, even though the desired result (e.g. the update of the
pacman database) is not even completed yet.

The `trap` has been removed, since it either wouldn't have worked
reliably (since the launched process was not kept track of) or it exited
immediately, causing the `rm` call to the pacman lock to execute and
delete any lock before the other processes are done.

Deleting the pacman lock in case of a failure is a benevolent idea, but
would require full error tracking for the pacman related processes.

This should fix issue greshake#30.
pitkley added a commit to pitkley/i3status-rust that referenced this issue Jun 6, 2017
Calling out to a shell is not necessary for a bulk of the commands in
`get_update_count`, it probably is bad practice to do so. This commit
cleans `get_update_count` up and removes most of the shell-calls.

In addition, `run_command` has been changed to wait for the executed
commands to exit. `Command::spawn` will spawn the processes without
blocking, i.e. the program will continue with it's normal execution
immediately, even though the desired result (e.g. the update of the
pacman database) is not even completed yet.

The `trap` has been removed, since it either wouldn't have worked
reliably (since the launched process was not kept track of) or it exited
immediately, causing the `rm` call to the pacman lock to execute and
delete any lock before the other processes are done.

Deleting the pacman lock in case of a failure is a benevolent idea, but
would require full error tracking for the pacman related processes.

This should fix issue greshake#30.
@pitkley
Copy link
Contributor

pitkley commented Jun 6, 2017

Since the refactor I did (#37) has been merged, can you (@greshake @keeslinp) check if you still have defunct processes? I have not experienced it since, but more data would be great 👍

@greshake
Copy link
Owner Author

greshake commented Jun 6, 2017

I'll keep an eye on it. by the way, I just noticed the click isn't working yet (you're not using a ButtonWidget)... Sorry for the big clusterfuck that is widgets and click handling right now.. Will be redone soon. Also, blocks that take a really long time to update currently block other blocks from updating. This will also be fixed with my partial rewrite.

@greshake greshake mentioned this issue Jun 29, 2017
@Peltoche
Copy link

Hi,
The issue is still running and is present in the spotify block too.

@pitkley
Copy link
Contributor

pitkley commented Jul 2, 2017

@Peltoche are you running an up-to-date version of i3status-rust? This was probably fixed with cb8ac6b, at least I haven't experienced this issue since then.

Be careful: if you update to a relatively recent version, you will have to update your configuration from JSON to TOML, see here on how to do it.

@greshake
Copy link
Owner Author

greshake commented Jul 2, 2017

@Peltoche I don't think this can be caused by the Music block. It's using a single thread to wait for Dbus signals, and it is only created on startup. Please elaborate if you have further information, 'is present' is not very helpful with a new issue. If the music block also has a thread leak, the issue won't be related to the pacman block.

@Peltoche
Copy link

Peltoche commented Jul 3, 2017

@pitkley an update fix it indeed, thanks.

@greshake
Copy link
Owner Author

greshake commented Jul 3, 2017

Alright, I assume that this is resolved now. Closing

@greshake greshake closed this as completed Jul 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants