| Anonymous | Login | Signup for a new account | 2013-06-19 05:34 CEST | ![]() |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | |||
| 0000108 | OCaml | OCaml general | public | 2000-05-11 18:35 | 2000-05-16 11:19 | |||
| Reporter | administrator | |||||||
| Assigned To | ||||||||
| Priority | normal | Severity | minor | Reproducibility | always | |||
| Status | closed | Resolution | fixed | |||||
| Platform | OS | OS Version | ||||||
| Product Version | ||||||||
| Target Version | Fixed in Version | |||||||
| Summary | 0000108: Bug/Feature in Unix.open_process_full | |||||||
| Description | Hello, I have a problem with the Unix.open_process_full function. It crashes with a nasty exception: uncaught exception Failure("equal: abstract value") on my test program. I've written a program that recreates the error, it is attached. The program forks a simple process called myecho. "myecho" reads input from stdin, and prints it out to stdout, and stderr after one second. The source program "t.ml" writes the string "1234567812345678" on its stdout (which is myecho's stdin) and waits. When the output comes back, it performs the same action. The second iteration fails. I think the problem is due to the fact that "t.ml" closes the channel through which it communicates with "myecho" prior to the call to Unix.close_process_full. This kind of functionality (closing the channel prior to performing Unix.close_process_full) is required in many programs. For example, PGP uses this kind of call sequence. Ohad. ---------------- ‹ÜÒ9 echo.tar íXmoÛ6î×èW\µ°»Ø³›ÄÞìº@1´ë€m-šm–u‚,Q6Z(*‹?þøÝI[ö[Ú|0d‰¼7´Z‹l©û+õàÓÑ`8ŒNOóñ“!þ#?Fîi8Æûñp0:;?Fcäž?Ààú´¡¦¶©x ?ÎÅòv¾j™ß‡;÷MJXH` ÝÖxkDš'J–:] YâÔÏ¥¼î×Jˆ †S|®Œ,mR[ü[@M#º±U³²¹0â_þkSƒÕ¨·ÒÆÆÄÝéâ ú¯W ûiKŸéõ?>|ýŸŽÏÆâ?õÔy|'êF?ÇðæÛ7Ä +L‘f‚JGÀÍ=oìë¿-E ¿ÊT鹄Wé:å1œ~ùõØó¾^¦ùžç¹È!Ó+Ä“ÔJ]¢j°Kó4»\Ý”9xG/å5 ÄÕ¢BÜ1i¹½l™š4C‡b¨×enôJìˆ8uS"A¡ ä²(„¥…+aj´Zƒ.¶ë¸c?t…‹C YDwׯ@³Ka›Î•@Ì~•ÖK;WýÁÛ ·y”¬-Ãzï"žIó<¡Yf?ÂáÐ?“»êáv[ãdæ&&xØwŒXé+Ѳ±cÁÍþÝÈ &¾Çÿ~!Ë<I•‚NєأzÏðòôóvo°^%2к‚\(›nª’õ2±rEas“_ô¡Ãn!,Mè"Oר£º®ù¹õdÀê¼ ·/žPÇÉ15P×"ÙðŽGsú±«·&‰Ùé×CñÁ%E.7ÙËÖ–Òâoد?×wÓÝHL7.–úÏàßÞƒY0ÓÓ?èX*X^s§=Üë/Y”~šƒè?¹{rób Îu-|ÖvzC?®ô88èñÃÀôl6ðÎúLÁ+Û=¤tjøâß˸ oPãéÉMšžü#M‘]W‚@oå’ë=¼ sa?cæ±·¢Rë?1Ž9ÙåU’ƒÛ:ƒ‹÷tÄŠß<ÿéÕ,þ#l<r ?¡¹÷¶?šTFg¢®![åè(b/Ì|îËá‘?xî?tt’ŠÀ-ˆ'EƒeJ:¶q’íž½*ghJÎÆ-ÁñÍŸ]]æ¢ÎL¢‹D– Í•By¯ºÇ$|;—wÕ³ù•„…„I¿ÔÃb.æÍbŽÚe®VÜG¬ÕxÃw§>Nj²mÜHs™mªqÞP²œs\éŠÑšu ”Øš•±S¤d ¯YvIƒÝ-,ì{\sê?ª'(0{”Ç~™øÔ?z)LbgЗT':ú”O££bc;Óe–Zˆcè0¬qU·ëõu!hV„æAªnæ~ dœ[ˆb¾?%.ä¦#nc!붸xƒ ü°3—ݶGáÜé¡Jme±Þ¯„Ûã ?êx˽ÉLC2Aiæn(ÙN0¶·T?7†žz²P—pi5ØfÕ¥TŠE9µ\€0·M?˜T¸UáñH.Jm„¯Wt»¥K>ò\ U1ÂHÂ/t1„Uµz2[mûæ{Ð~ílµt7žr?Ç?c'ýtÖ.‰ÜuÏCˆ‡PÿK_œÏl;¬)wüËêÇimsÚû„>º€×„UBþð6î%"9šÑ˜=?‹Â÷üÐ2%ð-†Ö}„Áä§Yˆft+?êRDGBa?jwÎé„Ìb¼`ˆWü](f£?pf¥³÷Û´Ìõ Ubi¢'f…Gºõ1H,À¥nTs×ñާsDé>\¼~û. ¡ãïèÞs³èW©©ÅÇ îù¶óÔw¥å–?5™Iìñ/ü$íËèJ¨åß¹tHˆY\£/\=?ûÉMh¬´ ùãi>{hñ'š£×†› ¶ô Ôûãá““Ó³Ñø«ð»Rn¥Bk¯Áo,m9U¤R1,Æßp?0A±¹ff]ÙØ³òîq6qdú9itöôQý}â‡)ª©—ô‰#ŒX¾Ÿ?-GŽ>äÇV6vÌ{ž8€þ,¼?ž}/6퇅ñÕÂån=o2Š.JVÎáOä ½$fÚ:‚ç‚#„Ë`Îêé¶ÂøàzÒÐÐÝ“ûü%ë‡ôRP£ý”6>ôýw¼ùþs2?éû/ÖÉáûÏ}Pÿüç—/¿ûõÅùú+ìÿxYÓEÒúÙJÓEÒå:Â!™DG:KW*ƒÞz|þÔÏ\‡]Ùí„$-?>»[Ñ1E}˜€×®ð5ŠžØë]q—±óôâ Ÿ2%çÐS ‚74|Z¥A,rªP?»¡Ñ–ïEží6m[aTI?µœ KExŒÃZ^¿û±âð¿ÅŸè@:Ð?t è@:ÐýÐ_ç=` ( ---------------- ---------------- | |||||||
| Tags | No tags attached. | |||||||
| Attached Files | ||||||||
Notes |
|
|
(0000385) administrator (administrator) 2000-05-16 11:18 |
> I have a problem with the Unix.open_process_full function. > It crashes with a nasty exception: > uncaught exception Failure("equal: abstract value") > on my test program. > > I've written a program that recreates the error, it is attached. Thanks, I had no problems reproducing the crash. It turns out to be an absurdity in the implementation of Unix.open_process* and Unix.close_process*. Namely, to keep track of which processes are attached to which channels, the Unix module uses an hash table indexed by I/O channels. This is totally bogus since (in OCaml 2.04 and 3.00 at least), equality on channels is unreliable and raises Failure("equal: abstract value") unless the two channel objects are physically equal. Any program that has several processes created with Unix.open_process* active at the same time may cause the Failure exception. Fortunately, OCaml 3.00 makes it very easy to attach a meaningful equality function to I/O channels. This is what the patch below does, and with it your test program works fine. > This kind of functionality (closing the channel prior to performing > Unix.close_process_full) is required in many programs. For example, > PGP uses this kind of call sequence. OK. This doesn't seem to cause any problems, since it is legal to close an I/O channel several times. Thanks for the bug report. Best regards, - Xavier Leroy Index: csl/byterun/io.c diff -u csl/byterun/io.c:1.41 csl/byterun/io.c:1.42 --- csl/byterun/io.c:1.41 Mon Apr 17 22:01:34 2000 +++ csl/byterun/io.c Tue May 16 11:11:51 2000 @@ -10,7 +10,7 @@ /* */ /***********************************************************************/ -/* $Id: io.c,v 1.41 2000/04/17 20:01:34 doligez Exp $ */ +/* $Id: io.c,v 1.42 2000/05/16 09:11:51 xleroy Exp $ */ /* Buffered input/output. */ @@ -376,10 +376,17 @@ stat_free(chan); } +static int compare_channel(value vchan1, value vchan2) +{ + struct channel * chan1 = Channel(vchan1); + struct channel * chan2 = Channel(vchan2); + return (chan1 == chan2) ? 0 : (chan1 < chan2) ? -1 : 1; +} + static struct custom_operations channel_operations = { "_chan", finalize_channel, - custom_compare_default, + compare_channel, custom_hash_default, custom_serialize_default, custom_deserialize_default |
|
(0000386) administrator (administrator) 2000-05-16 11:19 |
Fixed on 2000-05-16 by Xavier (added proper comparison function to I/O channels). |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2005-11-18 10:13 | administrator | New Issue | |
| Copyright © 2000 - 2011 MantisBT Group |