[torqueusers] qmgr truncates output in batch mode

Glen Beane glen.beane at gmail.com
Mon Jun 15 19:49:48 MDT 2009


On Fri, Jun 12, 2009 at 4:16 AM, Jan
Nilsson<jan.jn.nilsson at consultant.volvo.com> wrote:
> Garrick Staples wrote:
>
>> On Thu, Jun 11, 2009 at 04:58:30PM +0200, Jan Nilsson alleged:
>>
>>>
>>> Hi,
>>>
>>> We have experienced some problems using "qmgr -c <cmd>" in scripts.
>>> The output seemed truncated or the qmgr was crashing prematurely.
>>>
>>> When analyzing it in depth - we found that it seems to be connected to
>>> "qmgr" using the readline() utility.
>>>
>>> My colleague found that adding a fflush(NULL) before exiting solved the
>>> problem.
>>>
>>
>> Why at that exact location?  There are several ways out of the code.  Why
>> not
>> just stick it inside of clean_up_and_exit()?
>>
>
> Good point.
> This was a QnD fix to an acute problem - and we reproduced it in exactly
> that way out of the code.
> So I guess my colleague made a minimum fix... since we had (and still have)
> more urgent problems with TORQUE/MAUI.
>
> I think you're right though - clean_up_and_exit() seems like the right
> place.
> Something like this?
>
> -----------------  diff -Naur cmds*/qmgr.c --- cmds.old/qmgr.c
> 2009-06-11 16:04:47.000000000 +0200
> +++ cmds/qmgr.c 2009-06-12 10:11:23.000000000 +0200
> @@ -957,7 +957,7 @@
> /*
>  *
>  * clean_up_and_exit - disconnect from the servers and free memory used
> - *       by active object lists and then exits
> + *       by active object lists, flush output and then exits
>  *
>  *   exit_val - value to pass to exit
>  *
> @@ -983,6 +983,7 @@
>    cur_svr = next_svr;
>    }
>
> +  fflush(NULL);        /* peter h IPSec+jan n NANCO 2009 * fix truncated
> output. */
>
>  exit(exit_val);
>  }
> -------------



I've added this to 2.3-fixes and will be adding it to trunk soon (the
clean_up_and_exit version of the patch)


More information about the torqueusers mailing list