[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference pamsrc::decmessageq

Title:NAS Message Queuing Bus
Notice:KITS/DOC, see 4.*; Entering QARs, see 9.1; Register in 10
Moderator:PAMSRC::MARCUSEN
Created:Wed Feb 27 1991
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:2898
Total number of notes:12363

2764.0. "DMQ3.2 and ISAPI Stops Server on Attach" by XSTACY::dfrogz.ilo.dec.com::DOODY (Brian Doody) Tue Feb 11 1997 12:23

Folks,

I am developing a prototype WEB application using DMQ3.2 and ISAPI Extensionb dll's. I have the Dll's 
working for HTML and DMQ working from VC++4.0 (not using MFC) as a console application. Talking to an old 
VMS server.

Next step was to put the two together.
When I attempt to attach to a temporary queue the server (IIS) hangs.
both using Netscape and IE.

When I use the EYESAPI.exe test utility which is available on the net
everything works fine.

Any Ideas....
Thanks 

Brian Doody. ([email protected])

PS. all the printf statements will be logging instead in the final version :-)

====================================================================================================

.... Example code.....
1) dll


 DWORD WINAPI HttpExtensionProc( EXTENSION_CONTROL_BLOCK * pECB )

{

 char *data = NULL;
 char mystring[500];
 char connection_id[100];
 char totbytes[10];
 char bytesavail[10];
 char username[50];
 char stat[81];
 //char district_id[40];


 // DMQ
 //char  nouse[2];
 int32 first_run = FALSE; 
 int32 finished  = FALSE; 

 /* All Variables used in API calls are defined here */ 
 //INTEGERS
 int32 first_time;
 int32 poad_no; 
 int32 counter;

 // STRINGS	    
 char eqno[LQNO];
 char service_type[LSERVICE_TYPE];
 char district_id[LDISTRICT_ID];
 char release_date[LDATE_YYYYMMDD];
 char trigger_date[LDATE_YYYYMMDD];
 char poad_status[LFLAG];
 char poad_description[LTEXT_40]; 
 char isa[LFLAG];
 char local_yn[LFLAG];
 char model_change_yn[LFLAG];

 dcsu_attached = FALSE; 
// end dmq

 _itoa((int)pECB->ConnID,connection_id, 10);  
 
 if ( 0 == stricmp(pECB->lpszMethod, "post"))
   {
    _itoa(pECB->cbTotalBytes,totbytes,10);
    _itoa(pECB->cbAvailable,bytesavail,10);
	data = pECB->lpbData;
    strncpy( mystring, data, pECB->cbAvailable);
	mystring[pECB->cbAvailable] = '\0';
	strcpy(username,GetParamValue(pECB->lpbData,"USERNAME"));
	strcpy(district_id,GetParamValue(pECB->lpbData,"DISTRICT_ID"));
   }


 // do the DMQ stuff
   
  rs = dcsu_attach_bus();  <<<<<<<<< Problem occurs here
  _itoa(rs,stat,10); 
  DCSUPageHead (pECB, "Hello World Reply", MENU_BAR, "", district_id );
  WriteString(pECB,"DMQ Status="); 
  WriteString(pECB,stat);
  .....

  
 ========================================================

code for dcsu_attach_bus 



int32 dcsu_attach_bus(   ) 
/*---------------------------------------------+
 | Description   : Attaches to DMQ Message Bus |
 | Authorisation : None                        |
 | Returns       : DCSU_API_SUCCESS            |
 |                 DCSU_API_PREVATTACHQ        |
 +---------------------------------------------*/
{
   int32       attach_mode;
   int32       q_type;
   q_address   *q_addr;
   q_address   addr;                  

   q_addr =  &addr;                  // allocate the memory for Q-address

   q_type      = PSYM_ATTACH_PQ;
   attach_mode = PSYM_ATTACH_TEMPORARY;

   if (dcsu_attached) return(DCSU_API_PREVATTACHQ);
  
   dmq_status  = pams_attach_q(
                     &attach_mode,
                     q_addr,         // q address returned
                     &q_type,
                     (char *)  0,    // q_name 
                     (int32 *) 0,
                     (int32 *) 0,    // Use default name space  */
                     (int32 *) 0,      
                     (char *)  0,     
                     (char *)  0,     
                     (char *)  0 );

   dmq_error_check (dmq_status);
   printf( "Attached to queue : \"%d,%d\".\n",q_addr->au.group,q_addr->au.queue);
   dcsu_attached = TRUE;
   
   return(DCSU_API_SUCCESS);
  

} /*  end of dcsu_attach_bus  */
T.RTitleUserPersonal
Name
DateLines
2764.1XHOST::SJZRocking the Messaging Desktop !Tue Feb 11 1997 13:288
    
    when you say a VMS server you mean a VMS web server ?  as
    in you are doing the attach on the VMS side of the connec-
    tion ?  is your extension linked against the correct  ver-
    sion of the VMS software ?  is the  VMS  group  running ?
    have you considered turning on logging/tracing ?
    
    _sjz.
2764.2SIOG::BATEMANWe are all DECserversWed Feb 12 1997 03:288
    
    Have you tried starting DMQ prior to starting IIS? Just curious as I
    had problems with pams_get_msg hanging when clalling DMQ from ISAPI and
    NSAPI unless I started DMQ first (ie: as a service on system boot). At
    first I thought the problem was the MFC and MSCRT DLLs but using the
    DLLs that ship with the DMQ kit didn't fix the problem.
    
    Alan 
2764.3No client is DMQ3.2 NT basedXSTACY::dfrogz.ilo.dec.com::DOODYBrian DoodyWed Feb 12 1997 04:216
sjz.  Im using NT DMQ which has a cross-group connection to
      commumicate to a VMS-based group, but I am attaching to 
      to PC DMQ.
      The client runs on the PC and the server on the VMS side.
      THis works perfectly as a VC++4.0 console-based application.
  B.
2764.4XSTACY::imladris.ilo.dec.com::grainneWed Feb 12 1997 06:4932
I'm helping Brian look at this problem. Just to
clarify the response to sjz's question slightly:

The Windows NT PC is the DMQ client, and is also
running MS's IIS v2.0 HTTP server. The DMQ client
requests are made from an ISAPI DLL. The DMQ
server is on VMS. There's no HTTP server on the VMS
system.  Using the ISAPI DLL version of Brian's DMQ
client code, the IIS server hangs as soon as he
attempts a DMQ attach. This causes the browser clients
(either Netscape or MSIE) to report a 'peer has reset
connection' error.

Brian has a separate Windows NT DMQ client application
which performs the same functions but is a console app. 
rather than an ISAPI DLL. This works correctly against
the same VMS DMQ server used above. Also, the ISAPI DLL 
version of the DMQ client which crashes IIS works
with the EYESAPI freeware utility for testing ISAPI
DLLs. We're not quite sure what EYESAPI does, but presumably
it partially simulates IIS. 

Alan, I presume from your reply that you're successfully
doing at least an attach and a get_message from within
an ISAPI DLL ? Is there any chance you might have a
simple working code sample that we could compare with our 
non-working code ? 

Regards,
Grainne Ni Choiligh @ILO

2764.5XHOST::SJZRocking the Messaging Desktop !Wed Feb 12 1997 08:2014
    
    So it  is a Client Library  Application.  Given
    that, I gracisouly bow out to my co-workers who
    are much  more likely to  provide a real answer.
    My guess is somebody initializing  winsock  mul-
    tiple times (or something like that).
    
    However,  we are currently  having  our  yearly
    engineering meeting (last one was two years ago)
    and the people responsible for the  client  lib-
    rary are travelling.  They may not  be able  to
    answer  your  questions  until Friday or Monday.
    
    _sjz.
2764.6HOUBA::MEHERSDamian, http://bigbird.geo.dec.com/Wed Feb 12 1997 12:4723
    
    I'm not sure as to whether it is a CLS client, or simply the client
    part of a client-server application.
    
    I do know that Gary Burch in the UK has used DMQ sucessfully from within
    an ISAPI extension.
    
    I've just spoken with Brian on the 'phone, and suggested making sure
    that the bus and group ID environment variables were defined at the
    system level.
    
    If it is indeed using the CLS, then I believe there is an INI file that
    needs to be in the path of the IIS.
    
    Unless you spin off a background "worker thread" that stays permanently
    attached and performs DMQ calls on behalf of other threads, you will
    need to perform an attach, send/get (as many times as you wish),
    followed by a detach, each time your extension DLL gets invoked by the
    Web Server, since you cannot be sure that the Web Server will re-use
    the same thread.
    
    Cheers,
    		/Damian
2764.7HOUBA::MEHERSDamian, http://bigbird.geo.dec.com/Wed Feb 12 1997 12:5911
    
    I mentioned the use of DebugBreak() to pop up the debugger inside your
    DLL.  This will work for ISAPI Filters, but the Web Server seems to
    trap the interrupt for Extensions.
    
    Instead, check out
    	http://www.valley.net/~tpozzy/iisvcdb.html
    
    
    	Cheers,
    		/Damian
2764.8not the client library?WHOS01::ELKINDSteve Elkind, Digital SI @WHOWed Feb 12 1997 15:123
    With the client library, you don't specify bus and group environment
    variables.  Perhaps his client was using the runtime library and
    attached to a group running on the same NT box?
2764.9SIOG::BATEMANWe are all DECserversThu Feb 13 1997 04:085
    
    Brian phoned me yesterday and they are using the DMQ for WNT product
    (not the Client Library). But their ISAPI DLL was being built as a
    single threaded DLL - the /MD switch was missing.
    
2764.10SIOG::BATEMANWe are all DECserversThu Feb 13 1997 04:1313
    
    RE: .6 (Damian's note on thread context).
    
    One useful approach is to only attach once per thread and leave the
    thread attached permanently. This gets over the cost of attach/detach
    for each http request.
    
    The DllEntryPoint is a very useful place to put the attach/detach code: 
    for DLL_PROCESS_ATTACH and DLL_THREAD_ATTACH do the attach and
    DLL_THREAD_DETACH call pams_detach_q. Also a very useful place to
    manage your thread local storage.
    
    Alan
2764.11XHOST::SJZRocking the Messaging Desktop !Thu Feb 13 1997 08:117
    
    Um, err,  as far as I know (and I wrote "some" of the code).
    Each thread within the DMQ DLL for the Windows  NT  product
    gets its own context.  If thread A attaches queue  1,  then
    thread B cannot use it because it is owned by thread A.
    
    _sjz.
2764.12HOUBA::MEHERSDamian, http://bigbird.geo.dec.com/Thu Feb 13 1997 08:3818
    
    I assume that Alan means that each thread attaches to a different
    queue (or a temporary queue).
    
    This means that a specific queue can not be allocated for each Browser,
    since you can not be sure that two requests from the same Browser will
    be handled by the same thread thread inside IIS, and thus the ISAPI
    extension will not be called by the same thread (and thus share the same
    queue).
    
    What are the chances of DMQ allowing threads to exchange DMQ contexts,
    so that a thread that is not attached could grab the DMQ context from
    another thread (perhaps identified by primary queue number), leaving
    the other thread un-attached?
    
    My guess is that the chances amount to a fairly round number.
    
    	/Damian