Re: Expect & Multiprocessor Host Anomaly

From: Don Libes (libes_at_nist.gov)
Date: 03/23/05


Date: 23 Mar 2005 14:06:53 -0500

Marty Backe <marty@lucidway.org> writes:

> I recently migrated an Expect based Tcl application to a multiprocessor
> host and have since observed some odd behavior that defies my
> understanding. I'm posting here since I know Don reads the group and
> any answers will help others via http://groups.google.com
>
> BACKGROUND: The application uses expect_background extensively. While spawning
> a 'ping' process, expect_background is looking for "is alive" or "eof"
>
> PROBLEM: eof is triggered often, when I would anticipate "is alive". The
> curveball here is that on single processor machines I never get the 'eof'
> triggers (unless there's a problem of course). On a multprocessor host the
> 'eof' triggers are rampant.
>
> Inserting a delay between the spawn and expect_background helps substantially,
> but not totally.
>
> The example program below demonstrates the problem. Run on a single processor
> host and you'll never see an "End Of File" message. Run on a multiprocessor
> host and you'll get lots of "End Of File" messages.
>
>
> Any insight to this problem scenario would be appreciated. Thanks.
>
>
> EXAMPLE PROGRAM:
>
> #!/bin/sh
> #\
> exec tclsh8.4 "$0" "$@"
>
> package require Expect
>
> log_user 0
>
> proc loop {} {
> spawn /usr/sbin/ping 127.0.0.1
> # after 50
> expect_background {
> "is alive" [list cleanup $spawn_id "Is Alive"]
> eof [list cleanup $spawn_id "End Of File"]
> }
> }
>
> proc cleanup {spawnID string} {
> puts "$spawnID : $string"
> catch {expect_background -i $spawnID}
> catch {close -i $spawnID}
> catch {wait -i $spawnID}
> }
>
> proc cycle {} {
> puts \n
> for {se i 0} {$i < 10} {incr i} {
> loop
> }
> after 2000 cycle
> }
>
> cycle
>
> vwait forever

Either your system is fundamentally broken or my understanding is.
There's nothing (that I can think of) in Expect that cares whether a
system has multiple processors. What kind of OS are you on anyway?

I'd start digging by turning Expect's internal diagnostics. Assuming
they confirm the obvious, I'd then check a system trace. I'm thinking
they're going to show some inexplicable behavior from your system.

Don



Relevant Pages

  • Re: Packets from 255.255.255.255(80) (was: Packet from port 80 with spoofed microsoft.com ip)
    ... First time contributor and not too well informed but hoping to add to the ... I elected to check one of my snort alert ... The ip address of our host has been replaced with 'a_KWeb_host_ip'. ... It means very little to me, but I hope it may help your understanding. ...
    (Incidents)
  • RE: Unwrap returns VT_RECORD instead of VT_DISPATCH??
    ... Based on my understanding, so far you can host the managed C++ in the ... If I have any misunderstanding, please feel free to post here. ... Get Secure! ...
    (microsoft.public.dotnet.framework.interop)
  • Re: Remoting using http limited?
    ... it is my understanding that you will get that limit only if you host ... the object in iis. ... The real question is why are you trying to pass ...
    (microsoft.public.dotnet.framework.remoting)
  • Re: Static variable in dialog box proc
    ... was using an out-dated declaration of a struct that my ... DLL's host writes to. ... If you ever encounter similar odd behavior in the future, ...
    (microsoft.public.vc.language)