Once I process a takesocket set the bit pattern in RSNDMSK to the new socket Do a read then write go back to the select_loop control is never returned to the main task it’s that simple
> On Jan 6, 2019, at 3:28 PM, Seymour J Metz <[email protected]> wrote: > > First, a style issue; you have an explicit numeric length in XC > MY_ECB(104),MY_ECB rather than an implicit length, length attribute (L'FOO) > or equated symbols. That will cause you problems if you ever have to change > the size of the ECB list. > > Second, MODIFY is not the only type of CIB, If the COMM ECB is posted then > you need to process and delete the CIB, regardless of type, and regardless of > whether you recognize the text of a MODIFY. The types I would expect to see > are START, MODIFY and STOP. I would do a WTO for any CIB my code didn't > recognize, but you still need to delete it. > > What is SAVE14F? I hope it's not in your save area. > > Have you verified that every place you use WAIT ECB=MY_ECB you don't need > an ECB list? > > -- > Shmuel (Seymour J.) Metz > http://mason.gmu.edu/~smetz3 > > ________________________________________ > From: IBM Mainframe Discussion List <[email protected]> on behalf of > Joseph Reichman <[email protected]> > Sent: Saturday, January 5, 2019 11:58 PM > To: [email protected] > Subject: Re: Concurrent Server Task Dispatch issue multitasking issue > > Ok but this is going to be really long I do appreciate it the offer BTW I did > the changes with the SELECTEX etc nothing worked > Main Task Select these are listener tasks If it’s for a new connection > do a givesocket and post worker thread > Before I get any input from windows everything is fine meaning from WTO’s I > can see the subtask timing out and the main task > After I post a worker thread which is one of the ECB’s in the WAIT list of > the subtask then do TAKESOCKET IOCTL and READ call a program to process the > command > Write the response back to the Windows Client and then branch to the select > loop > It is at this point I have a problem meaning the I don’t see the wto’s from > the main task timing out > Thanks > > *********************************************************************** > * * > * Issue SELECT TO SEE IF ANY PENDING CONNECTIONS * > * * > *********************************************************************** > SELECT_LOOP DS 0H > XC MY_ECB(104),MY_ECB CLEAR ECB AREA > MVC COMMAND,=CL8'SELECT' > XC MY_PARM(MY_PARM_LEN),MY_PARM CLEAR PARAMTER LIST > EZASMI TYPE=SELECTEX, Issue Macro X > TIMEOUT=TIMEVAL, X > MAXSOC=MAXSOC1, SPECIFY MAXIMUM NUMBER OF SOCKETS X > RSNDMSK=RSNDMSK, READ MASK X > RRETMSK=RRETMSK, RETURN FROM READ X > WSNDMSK=WSNDMSK, WRITE MASK X > WRETMSK=WRETMSK, RETURN FROM WRITE X > ESNDMSK=ESNDMSK, X > ERETMSK=ERETMSK, X > ERRNO=ERRNX, (Specify ERRNO field) X > RETCODE=RETCODY, (Specify RETCODE field) X > ECB=MY_ECB, MAIN TASK EMB X > ERROR=ERROR, Abend if Macro error X > MF=(E,MY_PARM) > > > * WAIT 1,ECBLIST=ECB_LIST WAIT FOR SOMETHING TO HAPPEN > * > L R10,ECB_LIST+4 GET COMMUCATION ADDRSS ECB > TM 0(R10),X'40' MODIFY COMMAND POSTED > BZ CK_TCPIP NO CHECK TCP IP > * WTO 'PROCESSING MODIFY' > * > * DBGRDIE LINKAGE=SVC > * > L R6,COMMADDR Get Communication Addr > USING COM,R6 > L R6,COMCIBPT Point to CIB > DROP R6 > USING CIB,R6 > CLI CIBVERB,CIBMODFY Q. IS it a Modify > BNE SELECT_LOOP no; Go back > CLC CIBDATA,=CL8'SHUTDOWN' Shut Down > BE CLEAN_UP get out > B SELECT_LOOP > CK_TCPIP DS 0H > CLC RETCODY,=F'0' A REAL TIME OUT OCCURED ??? > BNH SELECT_LOOP > * DBGRDIE LINKAGE=SVC > *----------------------------------------------------------* > * if value is > 0 then this a read request to be handled * > * by subtask go back to main loop * > *----------------------------------------------------------* > MVC NOSELECT,RETCODY Save Number of Selected Sockets > BAL XLNK,CK_SELECT Check connections > B SELECT_LOOP > > TITLE 'CHECK SELECTION ACTIVITY.......' > CK_SELECT DS 0H > ST R14,SAVE14F Save link register > LA R6,SOCKTBL Get Socket tbl > USING SOCK_TBL,R6 > SEL_LOOP DS 0H > *********************************************************************** > * * > * check out Selected sockets * > * * > *********************************************************************** > TPIMASK TEST, X > MASK=RRETMSK, X > SD=TPIMSNO > BNE CK_EXCP > L R8,NOSELECT Number of Slected sockets > BCTR R8,0 Got Down by one > ST R8,NOSELECT > TM TPIMSBIT,TPIMSLIS *Is it our listener socket? > BO SPDOACC *- Yes, do an accept > WTO 'ERROR SOCKET TBL ' > B SEL_LOOP > SPDOACC DS 0H > * > EZASMI TYPE=ACCEPT, Issue Macro X > S=TPIMSNO, Socket X > NAME=CNAME, (SOCKET NAME STRUCTURE) X > ERRNO=ERRNX, (Specify ERRNO field) X > RETCODE=RETCODY, (Specify RETCODE field) X > ECB=MY_ECB, IN CASE WE ARE DOING EXITS OR ECBS X > ERROR=ERROR, Abend if Macro error X > MF=(E,MY_PARM) > * > > WAIT ECB=MY_ECB HAPPEN > * > * > * WTO 'AFTER ACCEPT' > AFT_ACP DS 0H > L R15,RETCODY > C R15,=F'0' > BH SET_MESS > CLC RETCODY,=F'-1' > BNE SET_A_ERR > CLC ERRNX,=F'35' > BE SET_MESS > WTO 'ERROR ACCEPT MACRO' > SET_A_ERR DS 0H > *--------------------------------------------------------* > * SINCE THE ACCEPT SOCKET WILL NEVER BE USED TO READ * > * AS THE GIVE SOCKET WILL GENERATE A NEW SOCKET TO * > * TO DO COMMUNICATION WITH HER_CMD WILL WIPE OUT THIS * > * BIT IN THE RSNDMSK BLOCKING A READ UNTIL HRTCPRD * > * GENERATES A NEW SOCKET AND WE WILL CLOSE IT OUT * > * AT THAT POINT WE WILL TURN THIS BIT BACK ON * > *--------------------------------------------------------* > * > *********************************************************************** > * * > * Issue GIVESOCKET * > * * > *********************************************************************** > WAIT_GIVE DS 0H > DROP R6 > USING SOCK_TBL,R6 > XC MY_ECB,MY_ECB > XC MY_PARM(MY_PARM_LEN),MY_PARM CLEAR PARAMTER LIST > EZASMI TYPE=GIVESOCKET, Issue INITAPI Macro X > S=TPIMSNO, X > CLIENT=CLIENT, SPECIFY SUBTASK IDENTIFIER X > ERRNO=ERRNX, (Specify ERRNO field) X > RETCODE=RETCODY, (Specify RETCODE field) X > ECB=MY_ECB, X > ERROR=ERROR, ABEND IF ERROR ON MACRO X > MF=(E,MY_PARM) > * > > WAIT ECB=MY_ECB > CLC RETCODY,=F'0' > BE POST_TASK > MVC COMM,=CL8'GIVESOCK' > BAL R14,RCCHECK --> DID IT WORK? > POST_TASK DS 0H > OI TPIMSBIT,TPIMSEXP > * > L R8,TPITSKAD > * > USING THREAD_DSECT,R8 > MVC SOCKET,TPIMSNO > DROP R6 > USING SOCK_TBL,R7 > * WTO 'GIVE SOCKET EXECUTED ..' > * DBGRDIE LINKAGE=SVC > XC MY_ECB,MY_ECB > XC MY_PARM(MY_PARM_LEN),MY_PARM CLEAR PARAMTER LIST > * > MVC COMM,=CL8'GIVESOCK' > * BAL R14,RCCHECK --> DID IT WORK? > * L R1,ECB_ADDR Get ecb address > POST (R1) Tell Task Work Waitting > * > B CK_SEL > CK_EXCP DS 0H > TPIMASK TEST, X > MASK=ERETMSK, X > SD=TPIMSNO > BNE CK_SEL > L R15,NOSELECT *Decrement number of > BCTR R15,0 *- selected socket descriptors > ST R15,NOSELECT * by one. > TM TPIMSBIT,TPIMSEXP *Did we expect it? > BNO CK_SEL SPECLOSE *- Yes, server has > EZASMI TYPE=CLOSE, Issue Macro X > S=TPIMSNO, CLOSE THIS SOCKET X > ERRNO=ERRNX, (Specify ERRNO field) X > RETCODE=RETCODY, (Specify RETCODE field) X > ECB=MY_ECB, X > T ERROR=ERROR, Abend if Macro error X > MF=(E,MY_PARM) > > * > WAIT ECB=MY_ECB > T CK_SEL DS 0H > L R15,NOSELECT > LTR R15,R15 Any More Socket > BNZ SEL_LOOP > L R14,SAVE14F RE-LOAD LINK REGISTERS * > BR XLNK > > Subtask SELECT LOOP > * > SELECT_LOOP DS 0H > XC MY_ECBT(104),MY_ECBT > EZASMI TYPE=SELECT, Issue Macro X > TIMEOUT=TIMEVAL, X > MAXSOC=MAXSNO, SPECIFY MAXIMUM NUMBER OF SOCKETS X > RSNDMSK=RSNDMSK, READ MASK X > RRETMSK=RRETMSK, RETURN FROM READ X > ESNDMSK=ESNDMSK, X > ERETMSK=ERETMSK, X > ERRNO=ERRNO, (Specify ERRNO field) X > RETCODE=RETCODE, (Specify RETCODE field) X > ECB=MY_ECBT, MAIN TASK EMB X > ERROR=ERROR, Abend if Macro error X > TASK=MYTIE, X > MF=(E,MY_PARX) > * > * Wait For Something to happen > * > * > WAIT 1,ECBLIST=ECBLST WAIT For Something top Happen > * > L R15,ECBLST Get first ECB > TM 0(R15),X'40' End Task ? > BO RETURN rETURN > L R15,ECBLST+8 Get Give/Take > TM 0(R15),X'40' GiveSocket Issued > BO CKGVE > * > L R15,ECBLST+4 > TM 0(R15),X'40' Ecb Posted FromRecovery rtn > BZ CKREADS no; > * > * Get ASCB In question > * > > CKREADS DS 0H > CLC RETCODE,=F'0' TimeOut ? > BNE CK_ERR Return > XC MY_ECBT,MY_ECBT > * > * WTO 'AT CALLDISP..........' > CALLDISP give up control > > * > B SELECT_LOOP > CK_ERR DS 0H > CLC RETCODE,=F'-1' Bad RC > BNE CKRET > MVC COMMX,=CL8'SELECT' > BAL R14,RCCHECK > B SELECT_LOOP > CKRET DS 0H > ************************************************************************ > * * > * check out Slected sockets * > * * > *********************************************************************** > TPIMASK TEST, X > MASK=RRETMSK, X > SD=READ_SOCK > BNE CK_OTHER > MVC IO_SOCK,READ_SOCK > B READ > CK_OTHER DS 0H > TPIMASK TEST, X > MASK=RRETMSK, X > SD=OTHER_SOCK > BNE SELECT_LOOP > MVC IO_SOCK,READ_SOCK > B READ > CKGVE DS 0H > *---------------------------------------------------------------------* > * GET THE SOCKET TO READ * > *---------------------------------------------------------------------* > L R15,ECB_ADDR Get ECB Address > XC 0(4,R15),0(R15) Clear Post Bit > MVC COMMX,=CL8'TAKESOCK' > XC MY_PARX(MY_PARX_LEN),MY_PARX CLEAR PARAMTER LIST > XC MY_ECBT(104),MY_ECBT CLEAR ECB ADDRESS > EZASMI TYPE=TAKESOCKET, Issue TakeSocket X > SOCRECV=SOCKET, X > CLIENT=SCLIENT, SPECIFY SUBTASK IDENTIFIER X > ERRNO=ERRNO, (Specify ERRNO field) X > RETCODE=RETCODE, (Specify RETCODE field) X > ECB=MY_ECBT, X > ERROR=ERROR, ABEND IF ERROR ON MACRO X > MF=(E,MY_PARX) > * > WAIT ECB=MY_ECBT > * > * > * > > CK_RET DS 0H > CLC RETCODE,=F'-1' > BNE WAIT_TAKE > BAL R14,RCCHECK > WAIT_TAKE DS 0H > MVC IO_SOCK,RETCODE+2 > CLC READ_SOCK,=2X'FF' Q, First time in > BNE SET_OTHER > MVC READ_SOCK,IO_SOCK > B CK_FLGS > SET_OTHER DS 0H > MVC OTHER_SOCK,IO_SOCK > * > * Set Selct to Tset This Socket out > * > CK_FLGS DS 0H > TPIMASK SET, X > MASK=RSNDMSK, X > SD=READ_SOCK > * > *********************************************************************** > * * > * Issue ioctl to set non blocking mode * > * * > *********************************************************************** > EZASMI TYPE=IOCTL, Issue Macro X > S=READ_SOCK, STREAM X > COMMAND='FIONBIO', (SOCKET NAME STRUCTURE) X > REQARG=NONBLOCK, X > RETARG=RETARG, X > ERRNO=ERRNO, (Specify ERRNO field) X > RETCODE=RETCODE, (Specify RETCODE field) X > ECB=MY_ECBT, IN CASE WE ARE DOING EXITS OR ECBS X > ERROR=ERROR, Abend if Macro error X > MF=(E,MY_PARX) > > * > WAIT ECB=MY_ECBT > > *********************************************************************** > * * > * Issue READ - Read data and store in buffer * > * * > *********************************************************************** > READ DS 0H > MVC MSG1(2),=AL2(49) > MVC MSG1+2(38),=CL38'DBGRTSK ABOUT TO EXECUTE READ FOR PORT ' > ST R1,SAVE1 SAVE R1 > XR R1,R1 CLEAR > ICM R1,B'0011',PORT# > CVD R1,DWORK > L R1,SAVE1 > MVC MSG1+41(6),=X'402120202020' > ED MSG1+41(6),DWORK+5 > OI MSG1+45,X'F0' > MVC WTO_LISX(WTO_LEX),WTO_CONS > WTO TEXT=MSG1,MF=(E,WTO_LISX) > WTO 'ABOUT TO EXECUTE READ SOCKET' > * DBGRDIE LINKAGE=SVC > LA R10,BUF > EZASMI TYPE=READ, Issue Macro X > S=IO_SOCK, Read Socket X > NBYTE=NBYTE, SIZE OF BUFFER X > BUF=(R10), (BUFFER) X > ERRNO=ERRNO, (Specify ERRNO field) X > RETCODE=RETCODE, (Specify RETCODE field) X > ERROR=ERROR, Abend if Macro error X > ECB=MY_ECBT, X > MF=(E,MY_PARX) > > L R15,RETCODE Get Number of bytes > LTR R15,R15 Q. Any Data Returned > BZ SELECT_LOOP Return > C R15,=F'-1' Error ? > BNE SET#BYTE > CLC ERRNO,=F'54' Connection closed > BE CLOSE Close it up > LTR R15,R15 Q. Any Data Returned > BZ SELECT_LOOP Return > C R15,=F'-1' Error ? > BNE SET#BYTE > CLC ERRNO,=F'54' Connection closed > BE CLOSE Close it up > BAL R14,RCCHECK > B SELECT_LOOP > SET#BYTE DS 0H > ST R15,IN_BUFF# Store number of bytes rd > L R15,ECBLST > XC 0(4,R15),0(R15) Clear ECB > MVC MSG1(2),=AL2(50) > MVC MSG1+2(50),=CL50'DBGRTSK AFTER READ !!!!!!!!!!' > MVC WTO_LISX(WTO_LEX),WTO_CONS > WTO TEXT=MSG1,MF=(E,WTO_LISX) > * WTO 'AFTER READ SOCKET .........' > * > LA R10,BUF > XC LINK_LIST(LINK_LEN),LINK_LIST CLEAR PARM AREA > MVC LINK_LIST(LINK_LEN),LINK_CON1 MOVE CONSTANTS > *-----------------------------------------------------* > * LINK TO ASCII TO EBCDIC SERVICE RTN * > *-----------------------------------------------------* > LINK EP=EZACIC05, X > PARAM=((R10),F20),VL, X > MF=(E,PARAMS),SF=(E,LINK_LIST) > > > LA R10,BUF get buffer area > * > XC CALL_LIST(CALL_LEN),CALL_LIST > * > MVC MSG1(2),=AL2(50) > MVC MSG1+2(50),=CL50'DBGRTSK BEFORE CALL EZACIC05.' > MVC WTO_LISX(WTO_LEX),WTO_CONS > * MVC LINK_LIST(LINK_LEN),LINK_CON2 MOVE > CONSTANTS > *-----------------------------------------------------* > * LINK TO PROCESS DBGR_CMD REQUEST * > *-----------------------------------------------------* > LR R12,R13 Point to Task Storage > LINK EP=DRVALCMD, X > PARAM=((R12)), X > MF=(E,PARAMS),SF=(E,LINK_LIST) > > LTR R15,R15 q. Did command Process > BZ CK_WRITE > LA R10,=F'4' > LA R11,ERRCODE > B WRITE_SOCK > CK_WRITE DS 0H > CLC BUF_LEN,=4X'00' Q. Any Length > BE READ Yes; Write > WRITE DS 0H > *********************************************************************** > * * > * Issue WRITE - Write data from buffer * > * * > *********************************************************************** > XC MY_ECBT(104),MY_ECBT > MVC TYPE,MWRITE MOVE 'WRITE ' TO MESSAGE > MVC MSG1(2),=AL2(50) > MVC MSG1+2(50),=CL50'DBGRTSK BEFORE EZACIC04......' > MVC WTO_LISX(WTO_LEX),WTO_CONS > WTO TEXT=MSG1,MF=(E,WTO_LISX) > CLI 0(R10),C'V' > BE SETPRM > L R10,BUF_LEN > MVC TR_LEN,BUF_LEN > B SETTRTBL > SETPRM DS 0H > L R10,TR_LEN Get length of storage > ETTRTBL DS 0H > LA R7,STANDARDE2A get address of tr tabler > L R11,OUTBUFFA gET OutPut buffer > LA R11,4(,R11) Past Length > * > TRLOOP DS 0H > CH R10,=H'255' < 255 > BL TRREST Translate rest > TR 0(255,R11),0(R7) Translate it > LA R11,255(,R11) Bump it up > SH R10,=H'255' Decrement > B TRLOOP Loop Thru > TRREST DS 0H > BCTR R10,0 Down by for Execute > EX R10,TRBUFF Do the rest > * > LA R10,BUF_LEN re-init for write > L R11,OUTBUFFA Buff Address > B WRITE_SOCK > TRBUFF TR 0(0,R11),0(R7) > * > WRITE_SOCK DS 0H > WTO 'AT WRITE SOCK..' > EZASMI TYPE=WRITE, Issue Macro X > S=READ_SOCK, ACCEPT Socket X > NBYTE=(R10), SIZE OF BUFFER X > BUF=(R11), (BUFFER) X > ERRNO=ERRNO, (Specify ERRNO field) X > ECB=MY_ECBT, X > RETCODE=RETCODE, (Specify RETCODE field) X > ERROR=ERROR, Abend if Macro error X > MF=(E,MY_PARX) > * > WAIT ECB=MY_ECBT WAIT FOR COMMAND COMPLETION > * > CLC RETCODE,=F'0' Q. DID WE GET ANYTING > BH WAIT_WRITE > CLC RETCODE,=F'0' Q. DID WE GET ANYTING > BNE CKRCWRTE > WTO 'ZERO BYTES WRITTEN' > B SELECT_LOOP > CKRCWRTE DS 0H > MVC COMMX,=CL8'WRITE' > BAL R14,RCCHECK CHECK FOR SUCCESSFUL CALL > WAIT_WRITE DS 0H > WTO 'WRITE COMPLETED...' > XC MY_ECBT,MY_ECBT > B SELECT_LOOP > > -----Original Message----- > From: IBM Mainframe Discussion List <[email protected]> On Behalf Of > Tony Thigpen > Sent: Saturday, January 5, 2019 10:05 PM > To: [email protected] > Subject: Re: Concurrent Server Task Dispatch issue multitasking issue > > You might need to post your full code so people can look at it to find the > problem. > > Tony Thigpen > > Joseph Reichman wrote on 1/5/19 7:52 PM: >> This is the situation both the main task and 4 sub tasks have selects >> after the time outs of the main task and subtasks I do wto When I get >> a connection the main task posts a subtask to do a EZASMI read and >> write and then go back to the select loop at this point I hardly see >> any WTOs from the main task time the modify command works about 1 out >> of 5 times >> >> >> >>> On Jan 5, 2019, at 7:14 PM, Brian Chapman <[email protected] >>> <mailto:[email protected]> > wrote: >>> >>> 1. Are you checking the COMM ECB after every wait? Even after a >>> subtask post the main task's ECB or any other ECB in your list? I've >>> had problems with subtasks posting the main task and not checking the >>> COMM ECB after servicing the subtask request and missing console commands. >>> >>> 2. Double check which ECB in your ECB list has the high order bit >>> set. I've added more ECBs in my list and forgot to move the high order bit >>> flip. >>> >>> On Jan 5, 2019 6:26 PM, "Joseph Reichman" <[email protected] >>> <mailto:[email protected]> > wrote: >>> >>> First off it is being posted I saw a X’48’ in the first byte the >>> operative bit being the 4 I am doing the wto on timeout from both >>> selects and the problem is that the main task doesn’t get control >>> >>> Thanks >>> >>> >>> >>>> On Jan 5, 2019, at 12:20 AM, Brian Westerman < >>> [email protected] <mailto:[email protected]> > >>> wrote: >>>> >>>> When you test the ECB is anything being posted? Is it possible that >>>> your >>> subtasks are actually sharing the ECBLIST for other use and they are >>> clearing it for you? >>>> >>>> It would be interesting to have all of your tasks (main and sub) wto >>>> when >>> they are posted so that you can see where you are when the post happens. >>> Possibly you are in a subtask, it gets posted and that subtask sees >>> that it's not "his" data, so clears things and moves on. I don't >>> share the ECBLIST between the main and subtask, so I'm not sure what >>> happens if you do, but it always seemed to me to be asking for trouble. >>>> >>>> Brian >>>> >>>> -------------------------------------------------------------------- >>>> -- For IBM-MAIN subscribe / signoff / archive access instructions, >>>> send email to [email protected] <mailto:[email protected]> >>>> with the message: INFO >>>> IBM-MAIN >>> >>> --------------------------------------------------------------------- >>> - For IBM-MAIN subscribe / signoff / archive access instructions, >>> send email to [email protected] <mailto:[email protected]> >>> with the message: INFO >>> IBM-MAIN >>> >>> --------------------------------------------------------------------- >>> - For IBM-MAIN subscribe / signoff / archive access instructions, >>> send email to [email protected] <mailto:[email protected]> >>> with the message: INFO >>> IBM-MAIN >> >> ---------------------------------------------------------------------- >> For IBM-MAIN subscribe / signoff / archive access instructions, send >> email to [email protected] <mailto:[email protected]> with >> the message: INFO IBM-MAIN >> >> > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, send email to > [email protected] <mailto:[email protected]> with the message: > INFO IBM-MAIN > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO IBM-MAIN > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
