Overview
Features
Download
Documentation
Community
Add-Ons & Services

Crashing with form writing

Please post support and help requests here.

Re: Re: Re: Re: Re: Re: Re: Crashing with form writing

Postby alex » 08 Dec 2008, 14:56

>Nobody can see that remotely for you because the problem appears to be somewhere in your settings, not the framework.

I forgot to mention - this is what you should see when there is no server available (with IP:port being whatever you are trying to connect to):

Code: Select all

Timeout: connect timed out: 127.0.0.1:12345
alex
 
Posts: 1130
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: Crashing with form writing

Postby chriso » 13 May 2009, 12:46

is it safe to run this code in a thread?

Code: Select all
try{
   URI uri( form.action.c_str() );
   std::string path(uri.getPathAndQuery());
   if (path.empty()) path = "/";

   HTTPClientSession session(uri.getHost(), uri.getPort());
   HTTPRequest req(HTTPRequest::HTTP_POST, path, HTTPMessage::HTTP_1_1);
   session.setTimeout(Poco::Timespan(10,0));

   // create the form data to send
   HTMLForm pocoForm(HTMLForm::ENCODING_URL);

   // form values
   pocoForm.set("nameOne", "valOne");
   pocoForm.set("nameTwo", "valTwo");

   pocoForm.prepareSubmit(req);
   pocoForm.write(session.sendRequest(req));

}catch (Exception& exc){
   if(verbose) std::cerr << exc.displayText() << std::endl;
}


I am finding that Poco is crashing in various places if there is no connection and you try to post a form. It seems that the timeout connection throw is making it crash. Maybe because it is running in a thread this is a problem?

Many thanks
chriso
 
Posts: 16
Joined: 28 Sep 2008, 17:42

Re: Crashing with form writing

Postby chriso » 03 Jun 2009, 19:18

anyone? is this code thread safe?

thanks
chriso
 
Posts: 16
Joined: 28 Sep 2008, 17:42

Re: Crashing with form writing

Postby guenter » 03 Jun 2009, 20:03

The given code is safe to run in a thread other than the main thread.
Could you tell us what compiler you are using? There are a few things I find rather strange - namely that it crashes in exception handling and that you get a SIGSEGV. Are you using MinGW or Cygwin or something? Might be an issue with the compiler then. I am not able to reproduce this with Visual C++.
guenter
 
Posts: 1135
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: Crashing with form writing

Postby chriso » 06 Jun 2009, 14:18

Hi

I am using gnu gcc (mingw), Codeblocks on Windows XP.

Do you think this could be the problem? Do you think its solveable?

Thanks
Chris
chriso
 
Posts: 16
Joined: 28 Sep 2008, 17:42

Re: Crashing with form writing

Postby guenter » 08 Jun 2009, 18:37

I don't have much experience with MinGW, but I have seen strange things (e.g., code that works perfectly everywhere else and crashes on Cygwin) with Cygwin GCC in the past, so I wouldn't rule out a compiler issue. What GCC version are you using? Another thing you could do is run the same code on Linux and see what it does there.
guenter
 
Posts: 1135
Joined: 11 Jul 2006, 16:27
Location: Austria

Previous

Return to Support

Who is online

Users browsing this forum: No registered users and 3 guests

cron