Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Strange behaviour of "script -a"



I don't know if I should really report this to this list, but it was discovered doing some testing of Java stuff and I thought this might be useful information for some.

We're working on a peer-to-peer application. In it we need to effectively use semaphors (see Java Threads, 2nd Edition or greater if you don't know what they are) to allow network I/O to complete without one I/O channel overwriting another.

In any case, our Head Honcho (a.k.a. BOSS) came up with the idea of "slamming" a ServerSocket with about 10 clients constantly bombarding the socket/port at random intervals between 0 and 10 mSec, and running this several million times in the hopes of detecting failed synchronization (data overwrites) or deadlock.

We ran the test and recorded the output from the server side using "script -a SyncTest.dat". We wrote programs to analyze the data from SyncTest.dat (which when done is about 250 MBytes in length). When we run these programs, which compare input messages to an echoed message from the server, they indicate tons and tons of errors. We look at them with "more" and some editors and see nothing. Finally the Head Honcho, who is an X-Windows freak, looks at them with "nedit". "nedit" shows us something we hadn't seen: "script -a SyncTest.dat" is periodically, for some reason, "embellishing" it's I/O with a periodic carriage returns, which is why our String comparisons fail. It also appeared like the server side had "dropped" a few messages.

In any case the Head Honcho says "Just re-direct I/O to a file and see what happens". We do this and guess what? All errors are now gone (as expected). Not only had script -a been "embellishing" I/O with apparently random carriage returns, it had also been "dropping" some of the data it was supposed to record to disk.

I thought I would mention this to all of you because I know that in a Unix environment using "script -a" is not an unusual way to log I/O, but in this case this program actually cost us about 6 hours of wasted time trying to hunt down non-existent bugs.

Cheers.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.