Re: OTSnd() weirdness
Re: OTSnd() weirdness
- Subject: Re: OTSnd() weirdness
- From: "Matt Slot" <email@hidden>
- Date: Mon, 23 Feb 2004 21:13:45 -0500
Mon, 23 Feb 2004 17:21:32 -0700
>
My OpenTransport server is using asynchronous blocking endpoints to
>
accept multiple connections.
>
I'm doing OTRcv() only from notifier code, but I'm trying to do all my
>
OTSnd() from my application's WNE loop.
>
>
Basically, I've got a number of different components that would like to
>
share the connection for send, and some of those run in interrupt
>
contexts, and some run at SystemTask time, so my application just
>
Enqueue()'s the data to be sent from wherever it is sent, and in the
>
WNE loop, looks to see if the queue is not empty, and calls OTSnd(),
>
Dequeue()ing when OTSnd is successful.
This is all well and good.
>
That's the theory, anyway. In actuality, when I call OTSnd(), I'm
>
finding that before it returns, I enter my notifier with a
>
T_MEMORYRELEASED for the buffer that was just sent, as well as T_DATA
>
whenever more data is pending. When I would return from the notifier, I
>
end up in MacsBug with "PowerPC illegal instruction at 00000008". This
>
is repeatable.
You really shouldn't enable ack sends, as they tend to cause more problems
than they solve. There's almost no advantage over using async, non-blocking
endpoints. More importantly, T_MEMORYRELEASED events may call your notifier
reentrantly and they are not necessarily as timely as you expect.
As for the crash, it sounds like your notifier is corrupting the stack.
Take a look at how you initialize your local variables and buffers.
>
Unfortunately, I have arrived at a point where I'm at a loss for how to
>
debug. Using the OpenTransport debug library doesn't help. I've
>
literally peppered my code with DebugStr(), and the last thing I see
>
before the crash is the DebugStr() immediately before the notifier
>
returns.
Use the following code at the start and end of your notifier:
if (event == T_MEMORYRELEASED)
DebugStr("\pT_MEMORYRELEASED ; dm sp 400");
That will print the top 1k of your stack. Then you can check to see if
there is anything changed. That said, you don't sound very proficient
with Macsbug debugging, so don't expect it to be readily apparent what's
causing the corruption.
Good luck,
Matt
+--------------------------+-----------------------------------+
| Matt Slot | Ambrosia Software, Inc. |
| Bitwise Operator |
http://www.AmbrosiaSW.com/ |
+--------------------------+-----------------------------------+
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.