Re: Expect & Multiprocessor Host Anomaly
From: Don Libes (libes_at_nist.gov)
Date: 03/23/05
- Next message: mpm_three_at_yahoo.com: "Packages and auto_path"
- Previous message: Cameron Laird: "Re: Getting the word to conventional programmers"
- In reply to: Marty Backe: "Expect & Multiprocessor Host Anomaly"
- Next in thread: Marty Backe: "Re: Expect & Multiprocessor Host Anomaly"
- Reply: Marty Backe: "Re: Expect & Multiprocessor Host Anomaly"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: mpm_three_at_yahoo.com: "Packages and auto_path"
- Previous message: Cameron Laird: "Re: Getting the word to conventional programmers"
- In reply to: Marty Backe: "Expect & Multiprocessor Host Anomaly"
- Next in thread: Marty Backe: "Re: Expect & Multiprocessor Host Anomaly"
- Reply: Marty Backe: "Re: Expect & Multiprocessor Host Anomaly"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|