Git Product home page Git Product logo

Comments (14)

themattrix avatar themattrix commented on July 17, 2024

Thanks for the issue submission! I'm just trying it on Cygwin for the first time myself.

It hung for me as well, but it didn't perform a dry-run. Are you sure you don't have CONCURRENT_DRY_RUN already set?

As for the hanging issue - it seems to be blocking on reading from (or writing to) the named pipe. Here's the last few commands before it hung:

+ printf '%s \e[1;37m%s\e[0m' 'Creating VM' '(on digitalocean)'
+ tput rc
+ read -r __crt__status
+ echo anim:
+ code=0
+ set -o errexit
+ trap INT
+ __crt__mark_task_with_code 0 0
+ local task=0
+ local code=0
+ echo task:0:0

Pressing CTRL+C runs the top-level signal handler, but then hangs at a familar place:

++ read -r __crt__status

My gut feel is that it's a buffering issue with the named pipe.

from bash-concurrent.

FredDeschenes avatar FredDeschenes commented on July 17, 2024

Yeah I worded that weirdly, I meant that it hung even in dry run mode (I tried both).

I just looked into this a bit before going to work and I found a couple of (old) Cygwin bugs relating to named pipes, including this one. I'll try to get more information on this tonight, but seems you were right about the named pipes!

from bash-concurrent.

themattrix avatar themattrix commented on July 17, 2024

Ah, understood! I did some googling around last night as well, but wasn't able to find an obvious way to fix the issue. I'll likely look into this more in the coming days...unless you find something first!

from bash-concurrent.

FredDeschenes avatar FredDeschenes commented on July 17, 2024

So I've got some bad news...

I'm pretty sure I've found what the issue is. Digging around a bit, I figured out that we only got into the event loop once (the part with read -r __crt__status).

I've reproduced the issue in this simpler use case. brokenTest.sh will only output "foo", then get stuck there, but works as expected on Linux. workingTest.sh works fine on both Cygwin and Linux.

Basically, it seems you can only write to a FIFO once, which is not the case on Linux. This led me to this Cygwin bug in their mailing list, which seems to explain the same issue (although using C). The bug just celebrated it's third birthday, but the developer said "so if you can hang tight for a year or three, it may well get resolved", so it might get fixed soon :P

So yeah I guess this sadly isn't going to work on Cygwin anytime soon!

from bash-concurrent.

themattrix avatar themattrix commented on July 17, 2024

I appreciate the research you've done into this! Seems like you are exactly correct. I wonder if there's another way to drive the event loop...

A little history: concurrent used to use wait -n (introduced in bash 4.3) for the first background process to exit. This got a bit more complicated when I introduced animations, and impossible when I introduced status updates for tasks. At that point I switched to using a named pipe which made everything much simpler. Going back to wait -n seems difficult.

Off the top of my head, another potential alternative is to have each writer append to a shared file, then have the event loop fed by a tail -f on that file. This would less efficiently emulate a named pipe, but may work on Cygwin.

I will look into this option (or others if you have any ideas) when I get some time.

from bash-concurrent.

FredDeschenes avatar FredDeschenes commented on July 17, 2024

Good idea with the tail -f, this seems to unlock the event loop properly (I can now see the animations and statuses being updated properly). Something else seems to be exploding later, I'll have a look at this too.

from bash-concurrent.

FredDeschenes avatar FredDeschenes commented on July 17, 2024

Mmm so the error I now have (still no idea what's happening, but something explodes when exiting, script exits with status 1)), but at least it also explodes on Linux! My bash-fu isn't so strong (I mainly use fish) so I probably broke something obvious. Anyway I'll look into it tomorrow/Sunday.

from bash-concurrent.

themattrix avatar themattrix commented on July 17, 2024

Hello! I ended up implementing the event pipe as normal file on a branch here. It works great in Linux and OS X, and theoretically should solve the problem in Cygwin (but I haven't tried it yet).

I was actually merely attempting to get nested instances of concurrent working (thus the branch name), but it seems that these features converged. 😄

from bash-concurrent.

FredDeschenes avatar FredDeschenes commented on July 17, 2024

Alright I'll have a look tonight, thanks!

from bash-concurrent.

FredDeschenes avatar FredDeschenes commented on July 17, 2024

Yup, that works fine, thanks!

from bash-concurrent.

themattrix avatar themattrix commented on July 17, 2024

That's great to hear! I still want to hammer on it a bit more, but I'll close out this issue when I merge it in. Thanks for all your help!

from bash-concurrent.

themattrix avatar themattrix commented on July 17, 2024

Just out of curiosity, does the display update really slowly in Cygwin for you? I'm using Babun, so maybe that's the reason.

from bash-concurrent.

FredDeschenes avatar FredDeschenes commented on July 17, 2024

Seems as fast as on a native Linux box, but I've only tried it on powerful machines so that might skew the results a bit.

from bash-concurrent.

themattrix avatar themattrix commented on July 17, 2024

Ah, that's good! I was running it on a pretty beefy box as well, so probably just some quirk of my configuration. :)

from bash-concurrent.

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.