Ticket UUID: | 875701 | |||
Title: | TIP#218 (Tcl Channel Driver Thread State Actions) | |||
Type: | Patch | Version: | TIP Implementation | |
Submitter: | davygrvy | Created on: | 2004-01-12 21:56:00 | |
Subsystem: | 25. Channel System | Assigned To: | andreas_kupries | |
Priority: | 8 | Severity: | ||
Status: | Closed | Last Modified: | 2005-01-28 05:54:15 | |
Resolution: | Accepted | Closed By: | andreas_kupries | |
Closed on: | 2005-01-27 22:54:15 | |||
Description: |
Initial patch.. work in progress, aiming for inclusion in 8.5.0 | |||
User Comments: |
andreas_kupries added on 2005-01-28 05:54:15:
Logged In: YES user_id=75003 Both final patches have been committed to 8.4 branch head and 8.5 head respectively. andreas_kupries added on 2005-01-28 05:51:23: File Added - 117453: tcl8.4_all_002.diff Logged In: YES user_id=75003 Upload of 8.4 final patch. andreas_kupries added on 2005-01-27 06:44:35: Logged In: YES user_id=75003 Reupload, found one small problem on windows, a new change by Mo used the old Cut function and I was not aware of it yet. Found it when the link failed. andreas_kupries added on 2005-01-27 06:43:33: File Deleted - 117284: File Added - 117297: tcl8.5_all_003.diff andreas_kupries added on 2005-01-27 05:33:29: File Added - 117284: tcl8.5_all_002.diff andreas_kupries added on 2005-01-27 05:33:26: Logged In: YES user_id=75003 The TIP has been accepted (6 yes, 0 no, 0 present). Updated the 8.5 patch with correct numbers for the new stub slots. davygrvy added on 2004-11-24 08:40:01: Logged In: YES user_id=7549 looks good so far will be testing over the next few days andreas_kupries added on 2004-11-24 07:05:35: Logged In: YES user_id=75003 Very good, thanks. davygrvy added on 2004-11-24 05:51:55: Logged In: YES user_id=7549 Andreas, trying patch today with my iocpsock extension. I'll post progress notes here later. andreas_kupries added on 2004-10-27 02:48:28: Logged In: YES user_id=75003 See also the bug report http://sourceforge.net/tracker/index.php?func=detail&aid=1021078&group_id=10894&atid=110894 andreas_kupries added on 2004-10-22 03:54:56: Logged In: YES user_id=75003 I have merged the base patch and driver conversion together, and updated them both to apply to the current 8.[45] CVS head. This patch has been called the "Full Ref. Implementation V1". I was able to create tests for fileevents for pipes which fail under windows for an unpatched core, and are ok for the patched core. These tests are 17.11[ab] in the package Thread, and were committed today as well. I consider this patch good enough for wider testing. I believe that this patch is ok. andreas_kupries added on 2004-10-22 03:50:43: File Added - 105992: refimpl_218.tar.gz andreas_kupries added on 2004-10-21 04:26:24: Logged In: YES user_id=75003 I added some more tests. I have now run tests against 8.5 head, and 8.4 head, pristine, with base patch, and base+driver patch (= 6 configs). I am unable to crash 8.5 with my tests, patches or not. 8.4 crashes the extended tests without patches, or only the base patch applied. It is ok if both base and driver patch are applied. This is for sockets. For pipes I was unable to crash my tests anywhere. It should however be possible to either crash transfered pipe channels, or to stop them from working (no events, due misdirected thread-alerts). I have found a limitation regarding transfered pipe channels and linux: Closing a transfered pipe channel in a different thread than it was created by causes an error, child lost. That seems to be a limitation in linux thread impl., and its interaction with waitpid. It is not a crash, just an error message about a lost child which is bogus. cleanup and all that seems to be ok however. andreas_kupries added on 2004-10-15 04:23:46: Logged In: YES user_id=75003 Seems that the thread extension does some basic tests of 'transfer', but only for files, in essence. It seems that I will have to extend this to cover all in-core drivers in some way or other. Uh, tests which are interdependent (18.1, .2, .3 for example). Nevertheless. This can be used for a basic first test. andreas_kupries added on 2004-10-15 04:00:04: File Added - 105145: driverconv_v1.tar.gz Logged In: YES user_id=75003 And here is the first patch for the conversions of all in-core channel drivers to v4. Even if it was just something like changing the version number and adding NULLs to the structure. The patches passed compilation and testsuite of Tcl, on linux and windows, for regular and threaded build. _Not_ tested yet is that these changes actually work when a channel for their is truly transfered. Because (I believe) this is not tested by the in-core testsuite. The thread extension might test this. Investigation will start on that. Still, others are welcome to play with this now. andreas_kupries added on 2004-10-09 03:45:59: Logged In: YES user_id=75003 Yes, the removal of the Tclp{Cut,Splice}... from the old hackish fix will happen as part of the conversion of all internal drivers to v4. For this patch I just wanted to get the API completely implemented, and the core running flawlessly, without touching the core drivers and their hardwired threadactions. I had to touch the hardwired socket splice, or cut, because of a bug regarding "socketList" and "socketListLock". Wherever I did that I added commentary about the removed code, as explanation. davygrvy added on 2004-10-09 03:36:36: Logged In: YES user_id=7549 Interesting.. I see TclpSpliceFileChannel(chan); and TclpSpliceSockChannel(chan); still there.. If this patch is step#2, we'll save removing those for step#3 when we convert all the channel types to v4, yes? davygrvy added on 2004-10-09 03:15:10: Logged In: YES user_id=7549 I'll modify my extensions to experiment on this. andreas_kupries added on 2004-10-09 03:07:34: File Added - 104396: threadaction-v2.tar.gz andreas_kupries added on 2004-10-09 03:07:33: Logged In: YES user_id=75003 Adding an updated ref. ipmlementation of the basics. The use of the thread actions when opening a channel means that existing code to add the instance data to a thread-global list is obsolete now, actually bogus, i.e. we get a damaged list. The updated diffs make the minimal changes necessary for the core to be ok again. This is not the convrsion of the existing drivers. This is enough for external channel drivers to use the API. andreas_kupries added on 2004-09-11 03:07:19: Logged In: YES user_id=75003 The TIP can be found at http://tip.tcl.tk/218 andreas_kupries added on 2004-09-11 03:05:45: File Deleted - 100955: Logged In: YES user_id=75003 The TIP is in the official repository, with official formatting and such. Removing the draft. The (a) class patches (bugfixes not requiring a TIP) are now committed to HEAD (8.5 dev) and 8.4 branch head. andreas_kupries added on 2004-09-10 05:58:07: File Added - 100955: channel_transfer.tip Logged In: YES user_id=75003 Attaching the TIP draft as well. andreas_kupries added on 2004-09-10 05:55:44: File Added - 100954: threadaction.tar.gz Logged In: YES user_id=75003 The patch had three components. (a) Bugs & Nits (b) v4 channel driver code. (c) Conversion of core drivers to v4. (a) can go into the core without TIP. (b) requires a TIP (c) is based on (b). Now enclosing a tarball for 8.4 and 8.5 implementing (b). The only thing missing are testcases for the new functionality. It does compile, and it does pass the unextended testsuite. I am ignoring (c) for now, until we get the TIP approved. andreas_kupries added on 2004-09-10 03:37:44: Logged In: YES user_id=75003 > 1) transformChannelType of generic/tclIOGT.c > had the version set to 2, not 3. It is setting > a wideSeekProc. Is 3 or 2 the correct version? 3 is the correct version. davygrvy added on 2004-01-23 11:40:32: Logged In: YES user_id=7549 This patch is not safe to use in its current form. I've found a bug i'm re-evaluating, a watchmask issue I need to solve. davygrvy added on 2004-01-17 03:03:41: Logged In: YES user_id=7549 Your note about checking HaveVersion was right. It will work in the forward direction, a v3 loaded into a core that understands up to v4, but not the other way. davygrvy added on 2004-01-17 03:00:52: Logged In: YES user_id=7549 Just discovered something interesting. If I create a v4 driver in an extension and load it into 8.4, Tcl_ChannelVersion incorrectly returns TCL_CHANNEL_VERSION_1 rather than TCL_CHANNEL_VERSION_3 The proper logic, I think would be to add a ceiling expecting more revisions in the future. Example: Tcl_ChannelTypeVersion Tcl_ChannelVersion(chanTypePtr) Tcl_ChannelType *chanTypePtr;/* Pointer to channel type. */ { if (chanTypePtr->version == TCL_CHANNEL_VERSION_2) { return TCL_CHANNEL_VERSION_2; } else if (chanTypePtr->version == TCL_CHANNEL_VERSION_3) { return TCL_CHANNEL_VERSION_3; } else if (chanTypePtr->version == TCL_CHANNEL_VERSION_4) { return TCL_CHANNEL_VERSION_4; /* reserve this space for future revisions. */ } else if (chanTypePtr->version < 15) { return TCL_CHANNEL_VERSION_4; } else { /* * In <v2 channel versions, the version field is occupied * by the Tcl_DriverBlockModeProc */ return TCL_CHANNEL_VERSION_1; } } davygrvy added on 2004-01-14 10:14:22: File Deleted - 73335: davygrvy added on 2004-01-14 10:13:19: File Added - 73366: patch.txt Logged In: YES user_id=7549 Final patch ready that includes doc changes. Things to note: 1) transformChannelType of generic/tclIOGT.c had the version set to 2, not 3. It is setting a wideSeekProc. Is 3 or 2 the correct version? 2) *ALL* channel drivers that maintain any tsd data are all now at version 4. This includes every win channel type, now. Not just restricted to file and socket. 3) HaveVersion() should be fine, re. email note. 4) All internal channel types are at or greater than v2. Even the mac/ ones that no longer are maintained by anyone. 5) Do a 'make genstubs' after applying patch. 6) all tests pass for a threaded build of Tcl. Does testthread do a transfer test and are there test cases? I haven't looked yet. davygrvy added on 2004-01-14 04:58:57: File Deleted - 73204: File Added - 73335: patch.txt davygrvy added on 2004-01-14 04:58:56: Logged In: YES user_id=7549 rev #3 patch ready. dkf added on 2004-01-13 17:16:46: Logged In: YES user_id=79902 David, please don't set Status to Pending since it means that it is Pending Deletion if further information is not supplied. Which is not what you meant at all! davygrvy added on 2004-01-13 16:58:39: Logged In: YES user_id=7549 Andreas, Could you have a look at this? Am I on-track? It looks complete to me ('cept for docs). How does it look to you? davygrvy added on 2004-01-13 07:48:24: Logged In: YES user_id=7549 Note to self: add Tcl_DriverCutProc and Tcl_DriverSpliceProc to the Tcl_Channel man page. davygrvy added on 2004-01-13 07:47:07: Logged In: YES user_id=7549 Untested on unix and mac, but those area where touched by the patch and needs testers. davygrvy added on 2004-01-13 07:46:02: File Deleted - 73183: davygrvy added on 2004-01-13 07:45:24: File Added - 73204: patch.txt davygrvy added on 2004-01-13 07:45:23: Logged In: YES user_id=7549 Only tested on Win2K. All tests pass for rev#2 !!! davygrvy added on 2004-01-13 04:56:01: File Added - 73183: patch.txt |
Attachments:
- tcl8.4_all_002.diff [download] added by andreas_kupries on 2005-01-28 05:51:23. [details]
- tcl8.5_all_003.diff [download] added by andreas_kupries on 2005-01-27 06:43:32. [details]
- refimpl_218.tar.gz [download] added by andreas_kupries on 2004-10-22 03:50:43. [details]
- driverconv_v1.tar.gz [download] added by andreas_kupries on 2004-10-15 04:00:04. [details]
- threadaction-v2.tar.gz [download] added by andreas_kupries on 2004-10-09 03:07:34. [details]
- threadaction.tar.gz [download] added by andreas_kupries on 2004-09-10 05:55:44. [details]
- patch.txt [download] added by davygrvy on 2004-01-14 10:13:19. [details]