Git Product home page Git Product logo

Comments (17)

josharian avatar josharian commented on May 3, 2024 1

It seems to me the simplest fix would be to make found buffered, with size concurrencyProcesses.

from gops.

josharian avatar josharian commented on May 3, 2024 1

I see now. Using len(pss) would work.

from gops.

dbraley avatar dbraley commented on May 3, 2024

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.

malisetti avatar malisetti commented on May 3, 2024

@siebenmann @dbraley could you please check if this PR fixes this issue.

from gops.

siebenmann avatar siebenmann commented on May 3, 2024

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.

malisetti avatar malisetti commented on May 3, 2024

@siebenmann thanks for the insight. I have modified the code to use wg instead of limitCh.

from gops.

yarcat avatar yarcat commented on May 3, 2024

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.

yarcat avatar yarcat commented on May 3, 2024

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.

yarcat avatar yarcat commented on May 3, 2024

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.

josharian avatar josharian commented on May 3, 2024

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.

yarcat avatar yarcat commented on May 3, 2024

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.

yarcat avatar yarcat commented on May 3, 2024

@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.

yarcat avatar yarcat commented on May 3, 2024

@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.

yarcat avatar yarcat commented on May 3, 2024

Oups, sorry, forgot to push the changes. Now it's there.

from gops.

yarcat avatar yarcat commented on May 3, 2024

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.

rakyll avatar rakyll commented on May 3, 2024

Since this is impacting many users, instead of leaving comments on #124, I sent out #126.

from gops.

dbraley avatar dbraley commented on May 3, 2024

Sorry for the delay! Can confirm this fixed the problem for me as well, thanks @rakyll, @yarcat, @mseshachalam,
& @josharian !

from gops.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.