ofLoadURLAsync crash when no network is available #1344

gorkacortazar opened this Issue Jun 20, 2012 · 10 comments

7 participants


ofLoadURLAsync crashes when no network is connected, on windows (codeblocks and vidual studio). Seeing the debugger, crashes when the poco::dnserror is being called.

My current workaround is to use ofLoadURL(...) in a threaded class, that work as expected (catches the error and logs the network error in the ofx console).

openFrameworks member

Thank you for your bug report.
This seems to be connected to #1312

openFrameworks member

sorry, just saw this. don't think this issue is related with #1312 at all, this makes unattended requests retry until the connection comes back instead of deleting them. i think #1312 could be related to:


chris was looking into that problem for ages and he couldn't find a solution, it seems it was related to some weird handling of exceptions in windows. the fact that it doesn't crash when run on a thread is probably because the exception makes the thread terminate instead of the whole process


i've removed the milestone from this issue because it's not likely something we can fix easily, even if it's a critical issue.

openFrameworks member

could someone (@arturoc?) document in here why it can not be easily fixed, and any other relevant information/findings? that way we don't have to start from scratch if we re-discover this in a year or so. ;-)

@arturoc arturoc closed this in d247f71 Sep 26, 2012
@arturoc arturoc reopened this Sep 26, 2012
openFrameworks member

Just uploaded a commit that might fix this. I think the problem was that we were catching the exception as a reference instead of const reference so if it's created in the stack when it arrives to the catch it's already destroyed and has lost it's inheritance not being a Poco::Exception anymore and not being catched. have also added one more catch to catch anything in case that doesn't work but not sure if it really fixes it. if someone can try under windows?


I just tested this, and I'm seeing lots of error messages come out every frame, but sometimes this crashes.

Debugger info:

#0 00000000 0x0316eced in ??() (??:??)
#1 00615BD0 _Unwind_SjLj_RaiseException(exc=0x2e731e0) (../../../../gcc-4.4.1/libgcc/../gcc/unwind.inc:113)
#2 00000000 0x006044a2 in __cxa_throw() (??:??)
#3 00000000 0x005b3bd6 in Poco::Net::DNS::error() (??:??)
#4 00000000 0x005b41eb in Poco::Net::DNS::hostByName() (??:??)
#5 00000000 0x0059deed in Poco::Net::SocketAddress::init() (??:??)
#6 00000000 0x005833db in Poco::Net::HTTPClientSession::reconnect() (??:??)
#7 00000000 0x00586153 in Poco::Net::HTTPClientSession::sendRequest() (??:??)
#8 0040BC22 ofURLFileLoader::handleRequest(this=0x2e8bde0, request={url = {static npos = 4294967295, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x2e7498c "http://cnn.com"}}, name = {static npos = 4294967295, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x2e7495c "blah"}}, saveTo = false, id = 0, static nextID = 1}) (C:\Documents and Settings\Administrator\My Documents\openFrameworks\libs\openFrameworks\utils\ofURLFileLoader.cpp:152)
#9 0040B309 ofURLFileLoader::threadedFunction(this=0x2e8bde0) (C:\Documents and Settings\Administrator\My Documents\openFrameworks\libs\openFrameworks\utils\ofURLFileLoader.cpp:116)
#10 0042DE67    ofThread::run(this=0x2e8bde0) (C:\Documents and Settings\Administrator\My Documents\openFrameworks\libs\openFrameworks\utils\ofThread.cpp:185)
#11 00000000    0x005d6e5e in Poco::ThreadImpl::runnableEntry() (??:??)
#12 77C3A3B0    msvcrt!_endthreadex() (C:\WINDOWS\system32\msvcrt.dll:??)
#13 7C80B729    KERNEL32!GetModuleFileNameA() (C:\WINDOWS\system32\kernel32.dll:??)
#14 00000000    0x00000000 in ??() (??:??)
openFrameworks member

that link you posted seems related, it's the same calls so it could be that and it's been close just some days ago, might be worth a try but i think it's only in their repo


ah I removed the link because it appears to be not windows specific but posting it here again:


it was about using gethostbyname_r:


@ofTheo ofTheo modified the milestone: 0.8.2, 0.8.1 Mar 30, 2014
openFrameworks member

So I've been trying to get this to reproduce, and I can't seem to do it (Windows 7).

Tried some infinite loops calling both async and blocking ofLoadURL* versions while disabling /. enabling the network adapter and also physically unplugging it. Async version would spam the console with [ error ] ofURLFileLoader: handleRequest(): No address found when the connection was out, but otherwise everything went just fine.

Is it possible this got silently fixed at some point? If not, what's a good minimal bug reproduction case?

EDIT: My testing code fwiw

string DDoSTarget = "http://www.openframeworks.cc/";

void ofApp::setup(){

    /* Testing blocking version
    while(true) {
        ofHttpResponse res = ofLoadURL(DDoSTarget);

void ofApp::urlResponse(ofHttpResponse & response) {
openFrameworks member

i think i fixed this by changing the exception to be const reference but nobody confirmed it, i'm going to close it

@arturoc arturoc closed this May 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment