Opened 6 years ago

Closed 6 years ago

#1900 closed defect (fixed)

Piping RAS_SET_TYPES output to grep --quiet blocks rasserver

Reported by: Dimitar Misev Owned by: Dimitar Misev
Priority: major Milestone: 9.7
Component: rasql Version: development
Keywords: Cc: Peter Baumann, Vlad Merticariu, Bang Pham Huu
Complexity: Medium

Description

It seems that when output from rasql for RAS_SET_TYPES is piped to grep --quiet, the connection from rasql isn't properly closed and the rasserver is left in an unavailable state. Piping to grep without a —quiet option makes no problem.

To reproduce:

# no problem
rasql -q 'select c from RAS_SET_TYPES as c' --out string | grep Result
# makes rasserver unavailable
rasql -q 'select c from RAS_SET_TYPES as c' --out string | grep --quiet Result

to check server availability:

rascontrol -x "list srv -all"

The issue happens with:

  • RAS_SET_TYPES
  • RAS_MARRAY_TYPES

But not with

  • RAS_STRUCT_TYPES
  • RAS_COLLECTIONS

Change History (3)

comment:1 by Dimitar Misev, 6 years ago

But not with

  • RAS_STRUCT_TYPES
  • RAS_COLLECTIONS

I found out why this is the case: the issue only happens when the number of results is ≥ 27 :-) When grep —quiet matches less than 27 results it's all fine.

And I have a feeling of what's actually going on: grep —quiet at some point decides this is enough matches to exit with a 0, so it probably just breaks the pipe before all output is processed, leading to something that rasql didn't expect.

-q, --quiet, --silent
   Quiet; do not write anything to standard output.
   Exit immediately with zero status if any match is found,
   even if an error was detected.
Last edited 6 years ago by Dimitar Misev (previous) (diff)

comment:2 by Dimitar Misev, 6 years ago

Found the issue: SIGPIPE needs to be ignored in rasql.

comment:3 by Dimitar Misev, 6 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.