1

I am writing an application that uses pion library and notice a crash when I try to send a request. The crash is happening due to segmentation fault. This is in Linux and I am linking with PION_FULL.

Code:

pion::net::HTTPRequest httpRequest("/sm_login/trusted.asp?app-id=test");
int port = 80;

httpRequest.setMethod("GET");
httpRequest.addHeader("Host", "127.0.0.1");

pion::net::TCPConnection connPtr(IO_service);

error = connPtr.connect(boost::asio::ip::address::from_string("127.0.0.1"), port);

if (error || !connPtr.is_open())
{
    dprintf(("Unable to establish connection"));
    return false;
}

httpRequest.send(connPtr, error);

Dump:

#0  0x0eec4bb4 in void pion::net::HTTPMessage::changeValue<std::tr1::unordered_multimap<std::string, std::string, CaseInsensitiveHash, CaseInsensitiveEqual, std::allocator<std::pair<std::string const, std::string> > >
>(std::tr1::unordered_multimap<std::string, std::string, CaseInsensitiveHash, CaseInsensitiveEqual, std::allocator<std::pair<std::string const, std::string> > >&, std::string const&, std::string const&) () from /sw/lib/libpion-net-2.2.12.so
#1  0x0eec11f0 in pion::net::HTTPMessage::send(pion::net::TCPConnection&, boost::system::error_code&) () from /sw/lib/libpion-net-2.2.12.so
#2  0x0f1e6c24 in CHeapInterface::SendRequest(std::string const&, std::string&, CHeapInterface::EHeapMsgType) () from /sw/lib/libMgmt.so

Thanks,

Neel Basu
  • 12,638
  • 12
  • 82
  • 146
mithuna
  • 1,011
  • 1
  • 9
  • 9

1 Answers1

1

The problem was due to mismatch in cross compiler version used to build pion libs. The application is not crashing anymore.

mithuna
  • 1,011
  • 1
  • 9
  • 9
  • Can you please elaborate? What flags did you use when it crashed, and which flags are used when you do not crash? I am having a similar problem. – Alex Shtoff Aug 10 '14 at 09:18