SIGBUS occuring in shared libray...

  • Follow


	I've a snippet of code in C++, which is dumping core after processing
a certain no. of requests... v r using Solaris 9 OS on a Ultra-60 sparc
machine, sunstudio 8 compiler, and TIBCO rendezvous protocol as
middleware.

The following is the part of code that is giving me trouble:

-------------------------------------------
time_t tnow;
time (&tnow);
struct tm vPtm;
struct tm *ptm = NULL;
ptm = localtime_r (&tnow, &vPtm);
char szDT[20] = "";
strftime (szDT, 9, "%Y%m%d", ptm);

TibrvMsg msgHdr, msg2;
TibrvMsg msgReq, msgRep;

//composing the message - start
msgHdr.updateString ("class_name", "Header");
msgHdr.updateString ("user_id", "XXXXXX");
msgHdr.updateString ("session_key", "55555");

msg2.updateString ("class_name", "XXXXXXXXXXXXXX");
msg2.updateString ("enddate", szDT);
msg2.updateString ("dp_code", "XXX");
msg2.updateString ("instr_id", "XXXXXXXXXXXX");
msg2.updateString ("account_id", "XXXXXXXX");
msg2.updateString ("instr_class", "ISIN");
msg2.updateString ("action_type", "X");
msg2.updateString ("misc1", "XXXXXX");

msg2.updateString ("misc2", "XXXXXXXX");
msg2.updateString ("misc3", "XXX");

msg2.updateF64 ("qty", 1.0);

msgReq.updateMsg ("Header", msgHdr);
msgReq.updateMsg ("XXXXXXXXXXXXXXXX", msg2);
//composing the message - over

msgReq.setSendSubject ("DUMMYSUBJECT");    //destination

TibrvStatus status = transport->sendRequest (msgReq, msgRep, 1.0);
-------------------------------------------

The code is a part of a shared library. After processing a certain(not
consistent) number of messages the program is dumping core...  when i
analyzed the core file i found out that:
            signal SIGBUS
            invalid address alignment.

this was the line of code that dbx was pointing to:
TibrvStatus status = transport->sendRequest (msgReq, msgRep, 1.0);

i've analyzed the code and could not find anything wrong. all the
buffers are filled under its allocated size, the double functions used
for getting time etc, are thread-safe etc...

the curious thing is that, when i reduced the no. of fields in the
message the program worked perfectly without dumping core.  and when i
increased the size of the message by adding more fields, the program
dumped core, and when i anlayzed the core file, and typed the 'dump'
command most of the variables were displayed like 'bad address
<address>'.

the core is never dumped after processing the first request. it happend
only after processing around 100 requests. i'm not getting a clue abt
this problem.

is there anyway to know accessing of which memory location caused the
sigbus to be generated using dbx? and i would like to know whether
there are any restrictions for the shared library in solaris regarding
the memory it can use? or anything related to memory?

i've been spending a lot of time on this issue... so, if  someone cud
please help me that wud be really appreciated....

thanks in advance

0
Reply myfavdepo (5) 8/25/2006 7:00:49 AM


0 Replies
247 Views

(page loaded in 0.044 seconds)

Similiar Articles:




7/25/2012 3:47:25 AM


Reply: