ofxHTTP segfault

Hello,
I am trying to run ofxHTTP’s example_basic_client and get a segfault.

It crashes in:

std::ostream& BaseClient::send(BaseRequest& request, Context& context)
{
...
    std::ostream& rawRequestStream = clientSession->sendRequest(request);
...
}

Same happens when I try the example_basic_client_loader.
I use osx, the most recent version of oF, ofxHTTP and its dependencies.

Certificates and everything should be in the right place.
Do I miss something important?

@bakercp Do you have any ideas?

Thomas

I’ll take a look asap … there’s something funny going on with SSL and the latest version of oF (e.g. https://github.com/bakercp/ofxSMTP/issues/12).

You’re just using the exact version of the demo right?

Yes, I did not touch it.
Let me know if you want me to do some tests.
Thanks for having a look.

Do you have a stack trace?

OK. I can confirm the issue on OSX with the latest stable. I’m 99% sure it’s the same issue as the ofxSMTP SSL issue.

If you change the target address to something without SSL (e.g. an http://openframeworks.cc/), what output do you get?

Everything without ssl works fine.

0	std::__tree_node_base<void *> *& std::__tree<std::string, std::less<std::string>, std::allocator<std::string>>::__find_equal<std::string>(std::__tree_node_base<void *> *&, std::string const&)	std::__1::__tree_node_base<void*>*& std::__1::__tree<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >::__find_equal<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(std::__1::__tree_node_base<void*>*&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)		0x1006908c6	
1	std::__tree<std::string, std::less<std::string>, std::allocator<std::string>>::__insert_unique(std::string const&)	std::__1::__tree<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >::__insert_unique(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)		0x100651530	
2	Poco::Net::X509Certificate::verify(Poco::Crypto::X509Certificate const&, std::string const&)	Poco::Net::X509Certificate::verify(Poco::Crypto::X509Certificate const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)		0x100a4c748	
3	Poco::Net::SecureSocketImpl::verifyPeerCertificateImpl(std::string const&)	Poco::Net::SecureSocketImpl::verifyPeerCertificateImpl(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)		0x100a4376a	
4	Poco::Net::SecureSocketImpl::verifyPeerCertificate(std::string const&)	Poco::Net::SecureSocketImpl::verifyPeerCertificate(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)		0x100a43645	
5	Poco::Net::SecureSocketImpl::verifyPeerCertificate()	Poco::Net::SecureSocketImpl::verifyPeerCertificate()		0x100a42f17	
6	Poco::Net::SecureSocketImpl::connectSSL(bool)	Poco::Net::SecureSocketImpl::connectSSL(bool)		0x100a42477	
7	Poco::Net::SecureSocketImpl::connect(Poco::Net::SocketAddress const&, Poco::Timespan const&, bool)	Poco::Net::SecureSocketImpl::connect(Poco::Net::SocketAddress const&, Poco::Timespan const&, bool)		0x100a42754	
8	Poco::Net::SecureStreamSocketImpl::connect(Poco::Net::SocketAddress const&, Poco::Timespan const&)	Poco::Net::SecureStreamSocketImpl::connect(Poco::Net::SocketAddress const&, Poco::Timespan const&)		0x100a4580d	
9	Poco::Net::HTTPSession::connect(Poco::Net::SocketAddress const&)	Poco::Net::HTTPSession::connect(Poco::Net::SocketAddress const&)		0x100a7c0ca	
10	Poco::Net::HTTPSClientSession::connect(Poco::Net::SocketAddress const&)	Poco::Net::HTTPSClientSession::connect(Poco::Net::SocketAddress const&)		0x100a3e36c	
11	Poco::Net::HTTPClientSession::reconnect()	Poco::Net::HTTPClientSession::reconnect()		0x100a648cb	
12	Poco::Net::HTTPClientSession::sendRequest(Poco::Net::HTTPRequest&)	Poco::Net::HTTPClientSession::sendRequest(Poco::Net::HTTPRequest&)		0x100a63ff8	
13	ofx::HTTP::BaseClient::send(ofx::HTTP::BaseRequest&, ofx::HTTP::Context&)	BaseClient.cpp	278	0x10008274c	
14	ofx::HTTP::BaseClient::execute(ofx::HTTP::BaseRequest&, ofx::HTTP::BaseResponse&, ofx::HTTP::Context&)	BaseClient.cpp	69	0x1000821ac	
15	ofx::HTTP::BaseClient::execute(ofx::HTTP::BaseRequest&, ofx::HTTP::BaseResponse&, ofx::HTTP::Context&)	BaseClient.cpp	86	0x100082250	
16	ofx::HTTP::BaseClient::execute(ofx::HTTP::BaseRequest&, ofx::HTTP::BaseResponse&, ofx::HTTP::Context&)	BaseClient.cpp	86	0x100082250	
17	ofApp::setup()	ofApp.cpp	49	0x10019a577	
18	ofBaseApp::setup(ofEventArgs&)	ofBaseApp.h	63	0x100199975	
19	std::shared_ptr<of::priv::Function<ofEventArgs, std::recursive_mutex>> ofEvent<ofEventArgs, std::recursive_mutex>::make_function<ofBaseApp>(ofBaseApp *, void (ofBaseApp:: *)(ofEventArgs&), int)::'lambda'(void const *, ofEventArgs&)::operator()(void const *, ofEventArgs&) const	ofEvent.h	345	0x10022ab6a	
20	decltype(std::forward<ofBaseApp>(fp)(std::forward<void const *, ofEventArgs&>(fp0))) std::__invoke<std::shared_ptr<of::priv::Function<ofEventArgs, std::recursive_mutex>> ofEvent<ofEventArgs, std::recursive_mutex>::make_function<ofBaseApp>(ofBaseApp *, void (ofBaseApp:: *)(ofEventArgs&), int)::'lambda'(void const *, ofEventArgs&)&, void const *, ofEventArgs&>(ofBaseApp&&, void const *&&, ofEventArgs&&&)	__functional_base	415	0x10022aae0	
21	bool std::__invoke_void_return_wrapper<bool>::__call<std::shared_ptr<of::priv::Function<ofEventArgs, std::recursive_mutex>> ofEvent<ofEventArgs, std::recursive_mutex>::make_function<ofBaseApp>(ofBaseApp *, void (ofBaseApp:: *)(ofEventArgs&), int)::'lambda'(void const *, ofEventArgs&)&, void const *, ofEventArgs&>(std::shared_ptr<of::priv::Function<ofEventArgs, std::recursive_mutex>> ofEvent<ofEventArgs, std::recursive_mutex>::make_function<ofBaseApp>(ofBaseApp *, void (ofBaseApp:: *)(ofEventArgs&), int)::'lambda'(void const *, ofEventArgs&)&&&, void const *&&, ofEventArgs&&&)	__functional_base	430	0x10022aab4	
22	std::__function::__func<std::shared_ptr<of::priv::Function<ofEventArgs, std::recursive_mutex>> ofEvent<ofEventArgs, std::recursive_mutex>::make_function<ofBaseApp>(ofBaseApp *, void (ofBaseApp:: *)(ofEventArgs&), int)::'lambda'(void const *, ofEventArgs&), std::allocator<std::shared_ptr<of::priv::Function<ofEventArgs, std::recursive_mutex>> ofEvent<ofEventArgs, std::recursive_mutex>::make_function<ofBaseApp>(ofBaseApp *, void (ofBaseApp:: *)(ofEventArgs&), int)::'lambda'(void const *, ofEventArgs&)>, bool (void const *, ofEventArgs&)>::operator()(void const *&&, ofEventArgs&)	functional	1407	0x10022a99c	
23	std::function<bool (void const *, ofEventArgs&)>::operator()(void const *, ofEventArgs&) const	functional	1793	0x10025bd3a	
24	of::priv::Function<ofEventArgs, std::recursive_mutex>::notify(void const *, ofEventArgs&)	ofEvent.h	81	0x10025b6cd	
25	ofEvent<ofEventArgs, std::recursive_mutex>::notify(ofEventArgs&)	ofEvent.h	473	0x10025b4aa	
26	void ofNotifyEvent<ofEvent<ofEventArgs, std::recursive_mutex>, ofEventArgs>(ofEvent<ofEventArgs, std::recursive_mutex>&, ofEventArgs&)	ofEventUtils.h	214	0x100252509	
27	ofCoreEvents::notifySetup()	ofEvents.cpp	193	0x100250b5c	
28	ofMainLoop::run(std::shared_ptr<ofAppBaseWindow>, std::shared_ptr<ofBaseApp>)	ofMainLoop.cpp	108	0x100222ff1	
29	ofMainLoop::run(std::shared_ptr<ofBaseApp>)	ofMainLoop.cpp	114	0x100223271	
30	ofRunApp(std::shared_ptr<ofBaseApp>)	ofAppRunner.cpp	158	0x100213ba5	
31	main	main.cpp	32	0x100198ab2	
32	start	start		0x100001fd4	

Found it.

For some reason, this commit broke SSL (or at least the way ofSSLManager()) does it.

https://github.com/openframeworks/openFrameworks/pull/4390

I’m investigating fixes …

Can you try with oF on this commit:

50ad4f3538548d60719256e4901a52ce5f933a3d

This also fixes the ofxSMTP issue.

OK. So the fix for now is to recompile FreeImage for your platform.

in the scripts directory

./apothecary update freeimage

… and that fixes it. Since the offending version of freeimage was compiled on 10.8, I’m wondering if there was an invisible ABI incompatibility at the OS level … I’ll look into a core solution for the next release. Can you confirm if this solution works and mark the issue as resolved if it does?

Your solution works.
Thanks a lot for this quick fix.

Great. Sorry for such an odd problem … I’ve been trying to track down a solution on the ofxSMTP side for a few days and your report clued me into the need to start a git bisect on the oF core … thanks!

Core issue here … https://github.com/openframeworks/openFrameworks/issues/4812

This has been fixed with openFrameworks 0.9.3.