1

I have an application developed under Linux with GCC 4.2 which makes quite heavy use of stringstreams to wrap and unwrap data being sent over the wire. (Because the Grid API I'm using demands it). Under Linux everything is fine but when I deploy to SunOS (v5.10 running SPARC) and compile with GCC 3.4.6 the app hangs when it reaches the point at which stringstreams are used.

****New Information added 9/7/2010**** So I still didn't solve this but after a lot of tinkering around I finally found a clue. In fact I think I found the problem but I'm at a loss how to fix it! See linker output below:

ld: warning: symbol `typeinfo for std::basic_iostream<char, std::char_traits<char> >' has differing sizes:
        (file /home/roony/dssdk/cppdriver/lib/libdsDriverGCC3.so value=0x28; file /usr/sfw/lib/libstdc++.so value=0x20);
        /home/roony/dssdk/cppdriver/lib/libdsDriverGCC3.so definition taken

So the warning says there is a mismatch in the definition of iostream etc between the two libraries but how to fix, or override one or the other.. ****End new information****

In more detail: The main thread accepts requests from clients and starts a new pthread to handle each request. The child thread uses stringstreams to pack data. When the child thread gets to that point it seems to hang for a second and then die. The main thread is unaffected.

Are there any known issues with stringstream and GCC 3.4.6 or SunOS or SPARCs? I didn't find anything yet...

Can anyone suggest a better way to pack and unpack large amounts of data a strings or byte streams?

Apologies for not posting code but this to me seems more involved than a simple syntax error. All the same, the thread crashes:

std::stringstream mystringstream;  //not here
mystringstream << "some data: ";   //but here

That is, I can declare the stringstream but when I try to use it something goes wrong.

roony
  • 11
  • 4
  • 1
    What did you try to solve this problem on SunOS? You could make an attempt and take the `stringstream` (I guess, it would be `sstream` and `iostream`) implementation from GCC 4.2 and use it in your 3.4.6 compiler. You could change the compiler. – M. Williams Apr 28 '10 at 16:15

2 Answers2

1

Probably the "some data" you want to put into the stream is invalid (for example already freed or char*s that are not properly allocated/...) or the data is modified by a different thread at the same time.

sth
  • 222,467
  • 53
  • 283
  • 367
0

I've had really bad luck working on SunOS with regards to POSIX compliance. But that may be neither here nor there.

The most immediate thing that comes to my mind is to try increasing your stack sizes for your threads. Perhaps you are running out of stack on SunOS. Linux has a very large and generous default stack size. I'm not sure about SunOS.

Brian Neal
  • 31,821
  • 7
  • 55
  • 59