Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 430345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T19:51:59+00:00 2026-05-12T19:51:59+00:00

This is weird and I’m not sure who the culprit really is. I’m doing

  • 0

This is weird and I’m not sure who the culprit really is.

I’m doing some scripting, on FreeBSD (6.2)? which makes extensive use of the following ***bash***ism:

do_something <(mysql --skip-column-names -B -e 'select ... from ... where ...;')

… where “do_something is a somewhat crufty utility (in Perl) that won’t read from a pipeline. If I use a regular file it works fine. My bash script using things like exec 4< <(...) with these sorts of queries (following by loops of the form while read x y z <&4; do ... never seem to have any issues.

However, Perl (5.8.x) seems to periodically block (apparently forever). I tried changing out the chomp(my $data = <MYDATA>); with a routine that used sysread and I wrote some test cases in Python for comparison. These seem to block far less often than the idiomatic Perl code, but they still do it sometimes. (The Python code using f.read() or os.read(f.fileno()...) seems to behave about equally in this issue).

I’ve tried reproducing the issue using ... <(cat ...) (where I’m cating the regular file) and that never seems to reproduce that stall.

I’ve glanced at some ktrace/kdump data … but I’m far more familiar with Linux strace or even Solaris truss … so I haven’t figured out what’s going from there yet, either.

I suppose we can mostly rule out Perl, because I’ve reproduced the same issue using Python … I don’t see how the bash could be doing anything wrong here (it’s just creating a named pipe in /var/tmp/sh-np-xxx and wiring the processes up to that).

What could the mysql shell/utility be doing that might cause this? I don’t think I’ve seen it from anything else (such as cat or dd). I haven’t tested this scenario under Linux … but I’ve used <(...) (process substitution) for years under Linux and don’t recall ever seeing this.

Is it a FreeBSD issue?

Sure I can work around the issue using temporary files … but I’d sure rather understand why it’s doing this (and avoid some of the races and clean-up messiness that temporary files entail).

Any suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T19:51:59+00:00Added an answer on May 12, 2026 at 7:51 pm

    The big difference between operating on the output of mysql and directly on a file is timing. When the perl process is stalled, the big question is: “why is it not making forward progress”? You can use the “l” option to ps to see the wait channel for the perl process; that way you can see if it blocked on a read, or if something else is going on. If it is really blocked on pipe input, I expect the MWCHAN entry for perl to be “piperd”.

    The same information would be interesting for the mysql process.

    What does your Python test code look like?

    Another way of writing this while avoiding the bashism is this; that would allow you to rule out bash:

    mysql --skip-column-names -B -e 'select ... from ... where ...;' | do_something /dev/stdin
    

    Other interesting questions:

    • Does the –unbuffered option to mysql change anything?

    • Does piping the mysql output through dd change anything? (eg. “perlscript <(mysql … | dd)

    Summary: Need more information.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this weird behavior in C which I do not understand. It is
Could someone please explain this weird phenomenon: http://jsfiddle.net/sPA2V/ For some reason, the box footer
I have this weird issue which i'm absolutely don't even know how to address...
This is a really weird problem. It's taken me practically all day to whittle
I'm experiencing this weird problem which my scrollbar jumps by itself to somewhere that
Im having this weird problem with creating Json dynamically.... for some reason this doesnt
Had this weird bug in my code and I was not able to solve
I got this weird problem where System.Action cant be resolved when its not explicitly
I am getting this weird error message can not sort on multivalued field: fieldname
I am facing this weird problem not in a normal behavior. I am loading

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.