Comments (17)
It seems to me the simplest fix would be to make found
buffered, with size concurrencyProcesses
.
from gops.
I see now. Using len(pss) would work.
from gops.
This is impacting me as well. Was able to get around it temporarily by upping the magic number to 100 without a problem, though that's obviously not the right fix.
from gops.
@siebenmann @dbraley could you please check if this PR fixes this issue.
from gops.
Purely on inspection I believe that this will fix the issue I'm experiencing, however I believe it will also reintroduce issue #118. Since limitCh
is now sent to in a new goroutine that has no other purpose, there's nothing to stop a flood of goroutines calling isGo()
and using too many file descriptors at once.
from gops.
@siebenmann thanks for the insight. I have modified the code to use wg instead of limitCh.
from gops.
The change introduced above (see #125) moves the whole for-loop into a go routine (also suggested in the issue description). Ignoring the whitespace changes (git diff -b
) is far the best way to understand the diff.
from gops.
I personally prefer to avoid buffered channels, but yeah -- it's possible as well.
UPD: See the comment below, where I explain why this actually isn't gonna work with concurrencyProcesses
buffer size.
from gops.
Actually, did not initially notice that concurrencyProcess
buffer limit proposed by @josharian. Imho it isn't gonna help. Imagine that we have more than concurrencyProcess
Go processes. After the first batch of concurrencyProcess
workers we will fill the output buffer, and will get to exactly the same situation as we are in right now. The only correct way in this case is to create a buffer of future len(results)
, which is unknown, and the nearest known value would be len(pss)
.
from gops.
But by that point, receiving from found
will have commenced. In any case, there's no need to speculate. That's what tests are for. :)
from gops.
But reading from found
happens after the main for-loop. It will never get there, because it will get stuck in the same way it gets stuck now.
from gops.
@josharian I've refactored my cl and made it testable.
UPD: Removed "Please try with len(pss)
-- it will hang." Of course it will work. Sorry seems I have problems finishing reading sentences today (-;
from gops.
@josharian Added a fix-123-buffered branch. Please take a look and feel free to try it out yourself.
UPD: And yes, surely it would work with len(pss)
as we've agreed earlier.
from gops.
Oups, sorry, forgot to push the changes. Now it's there.
from gops.
Also added a version, which creates less go-routines, and doesn't use buffered channels. Please take a look https://github.com/yarcat/gops/blob/fix-123-no-buffers/goprocess/gp.go (the branch is still based on a PR #125)
from gops.
Since this is impacting many users, instead of leaving comments on #124, I sent out #126.
from gops.
Sorry for the delay! Can confirm this fixed the problem for me as well, thanks @rakyll, @yarcat, @mseshachalam,
& @josharian !
from gops.
Related Issues (20)
- can not install binary file to gopath/bin
- Alpine Couldn't resolve addr or pid 1 to TCPAddress: couldn't get port for PID 1: open /root/.config/gops/1: no such file or directory HOT 1
- gops stack 38744 => Couldn't resolve addr or pid 38744 to TCPAddress: couldn't get port for PID 38744: HOT 1
- Amazon triple containing
- Stacktrace in 'debug=1' format
- Install failed HOT 2
- osx: no such file or directory: /src HOT 1
- gops crashes on macos without a CLI command on startup HOT 1
- gops does not validate time duration parameter HOT 2
- improve CI/CD release process with GitHub Actions and GoReleaser
- go get failed in m1
- run gops panic HOT 3
- gops can not list process in Mac book with m1 chip HOT 8
- Couldn't resolve addr or pid <pid> to TCPAddress HOT 2
- gops depends on the now retracted github.com/shirou/gopsutil v3.22.11 HOT 1
- json output?
- Turning off the GC via setgc is cumbersome
- The reported CPU usage is much higher or lower than top reported value?
- Any restrictions on rootless containers?
- Missing Go process (with agent)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gops.