Thread: [Cppcms-users] Advice on debugging file upload
Brought to you by:
artyom-beilis
From: doug l. <bi...@gm...> - 2012-04-22 20:08:40
|
Hi -- I'm trying to develop an image server which raises the following error when I send a post request to create a new file: 2012-04-22 20:55:28; cppcms, error: Caught exception [File was not loaded] 0x10176c2b3: cppcms::cppcms_error::cppcms_error(std::string const&) + 0x63 in /usr/local/lib/libcppcms.1.dylib (http_context.cpp:139) Could anyone offer me any advice on good ways to start debugging to find the source of the error, here? Thanks, Doug. |
From: Artyom B. <art...@ya...> - 2012-04-23 06:30:43
|
Two things. 1. This exception is thrown when you try to access a file (cppcms::widgets::file::value()) and the file was not uploaded. You can check if the file was uploaded by using cppcms::widgets::file::set() member function before using value. See: http://cppcms.com/cppcms_ref/latest/classcppcms_1_1widgets_1_1file.html#a56ee053415b1bd98944bb3599e3392b1 2. To debug this problem you should be able to see full stack backtrace in the log - and AFAIR it should work under Mac OS X, if not tell me. To check if backtrace works, please compile booster/lib/backtrace/test/test_backtrace.cpp As g++ -O0 -dynamic booster/lib/backtrace/test/test_backtrace.cpp -lbooster And see if you get stack trace when you run the program. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >________________________________ > From: doug livesey <bi...@gm...> >To: cpp...@li... >Sent: Sunday, April 22, 2012 11:08 PM >Subject: [Cppcms-users] Advice on debugging file upload > > >Hi -- I'm trying to develop an image server which raises the following error when I send a post request to create a new file: > > >2012-04-22 20:55:28; cppcms, error: Caught exception [File was not loaded] >0x10176c2b3: cppcms::cppcms_error::cppcms_error(std::string const&) + 0x63 in /usr/local/lib/libcppcms.1.dylib > (http_context.cpp:139) > > >Could anyone offer me any advice on good ways to start debugging to find the source of the error, here? >Thanks, > Doug. >------------------------------------------------------------------------------ >For Developers, A Lot Can Happen In A Second. >Boundary is the first to Know...and Tell You. >Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! >http://p.sf.net/sfu/Boundary-d2dvs2 >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |
From: doug l. <bi...@gm...> - 2012-04-23 11:25:26
|
Thanks for your reply, there. I'm a little unsure about the backtrace, though, sorry -- I haven't explicitly setup any logging (I'm still finding my way, really), so there won't be anything there. Do you mean that I should include the test_backtrace compilation you suggest into my project compilation? & sorry if I'm being dense. :) Doug. |
From: Artyom B. <art...@ya...> - 2012-04-23 11:30:11
|
>Thanks for your reply, there. >I'm a little unsure about the backtrace, though, sorry -- > I haven't explicitly setup any logging (I'm still finding my way, really), so there won't be anything there. What you see is already log, if logging is not defined it goes to stderr >Do you mean that I should include the test_backtrace compilation you suggest into my project compilation? >& sorry if I'm being dense. :) No, I do not have latest Mac OS X, only Darwin 8 (~Mac OS X 10.4) so I could not test backtrace feature that should be available in latest versions of Mac OS X. Generally you should be able to see a stack bactrace for exceptions thrown by CppCMS in the log (if this feature works) It would be nice if you could check it with the test program I had pointed to. By compilation and running this program you can see if you actually getting any stack trace or not. So if you could compile and run the program with the parameters I had shown it could answer on the question whether backtrace works on Mac OS X or not. Thats it. > Doug. > > Artyom |
From: doug l. <bi...@gm...> - 2012-04-23 12:05:11
|
Ah, right, sorry -- well, the program complies, but then throws this error when it runs: ~/src/cppcms-1.0.1/mybuild$ ./a.out My Error 0x107963102: booster::backtrace::backtrace(unsigned long) + 0x76 in /Users/douglivesey/src/cppcms-1.0.1/mybuild/./a.out 0x1079632c9: booster::runtime_error::runtime_error(std::string const&) + 0x39 in /Users/douglivesey/src/cppcms-1.0.1/mybuild/./a.out 0x107962eda: foo() + 0x4a in /Users/douglivesey/src/cppcms-1.0.1/mybuild/./a.out 0x107962f4a: bar() + 0x9 in /Users/douglivesey/src/cppcms-1.0.1/mybuild/./a.out 0x107962f5d: main + 0xe in /Users/douglivesey/src/cppcms-1.0.1/mybuild/./a.out 0x107962e88: start + 0x34 in /Users/douglivesey/src/cppcms-1.0.1/mybuild/./a.out |
From: Artyom B. <art...@ya...> - 2012-04-23 12:17:52
|
> > >Ah, right, sorry -- well, the program complies, but then throws this error when it runs: > >~/src/cppcms-1.0.1/mybuild$ ./a.out >My Error >0x107963102: booster::backtrace::backtrace(unsigned long) + 0x76 in /Users/douglivesey/src/cppcms-1.0.1/mybuild/./a.out >0x1079632c9: booster::runtime_error::runtime_error(std::string const&) + 0x39 in /Users/douglivesey/src/cppcms-1.0.1/mybuild/./a.out >0x107962eda: foo() + 0x4a in /Users/douglivesey/src/cppcms-1.0.1/mybuild/./a.out >0x107962f4a: bar() + 0x9 in /Users/douglivesey/src/cppcms-1.0.1/mybuild/./a.out >0x107962f5d: main + 0xe in /Users/douglivesey/src/cppcms-1.0.1/mybuild/./a.out >0x107962e88: start + 0x34 in /Users/douglivesey/src/cppcms-1.0.1/mybuild/./a.out Ok, the stack backtrace works on Mac OS X. If so you should probably see where exactly the exception comes from in the log - including cppcms::widgers::file::value() in the stack trace. Use it, it is very powerful tool. (Don't forget -dynamic options) Artyom |
From: <ele...@ex...> - 2012-04-23 12:20:58
|
I've been following this discussion and I ran the same test on FreeBSD 8 and it only prints "My Error", but no trace. Petr >>~/src/cppcms-1.0.1/mybuild$ ./a.out >>My Error >>0x107963102: booster::backtrace::backtrace(unsigned long) + 0x76 in >> /Users/douglivesey/src/cppcms-1.0.1/mybuild/./a.out >>0x1079632c9: booster::runtime_error::runtime_error(std::string const&) + >> 0x39 in /Users/douglivesey/src/cppcms-1.0.1/mybuild/./a.out >>0x107962eda: foo() + 0x4a in >> /Users/douglivesey/src/cppcms-1.0.1/mybuild/./a.out >>0x107962f4a: bar() + 0x9 in >> /Users/douglivesey/src/cppcms-1.0.1/mybuild/./a.out >>0x107962f5d: main + 0xe in >> /Users/douglivesey/src/cppcms-1.0.1/mybuild/./a.out >>0x107962e88: start + 0x34 in >> /Users/douglivesey/src/cppcms-1.0.1/mybuild/./a.out > > > Ok, the stack backtrace works on Mac OS X. > > > If so you should probably see where exactly the exception comes from in > the > log - including cppcms::widgers::file::value() in the stack trace. > > Use it, it is very powerful tool. > > (Don't forget -dynamic options) > > Artyom > > > ------------------------------------------------------------------------------ > For Developers, A Lot Can Happen In A Second. > Boundary is the first to Know...and Tell You. > Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! > http://p.sf.net/sfu/Boundary-d2dvs2 > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
From: Artyom B. <art...@ya...> - 2012-04-23 12:36:47
|
The backtrace support requires some API in the standard C library. Linux, Mac OS X, Solaris: Getting trace: execinfo.h + backtrace() Getting symbols: dladdr Windows: Getting trace: RtlCaptureStackBackTrace Getting symbols: SymFromAddr (MSVC Only) Unfortunately FreeBSD does not provide such API, so it is not possible to create safe backtrace - the existing execinfo.h library that comes with FreeBSD is not safe when using with "omit-frame-pointer" optimization. If you find any other suitable way to create a backtrace (at least backtrace - not backtrace_symbols) it would be possible to provide stack tracing for FreeBSD as well. For example, backtrace would not work on Linux with uclibc as well and it is not possible to print symbols using Windows+GCC. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ ----- Original Message ----- > From: "ele...@ex..." <ele...@ex...> > To: Artyom Beilis <art...@ya...>; cpp...@li... > Cc: > Sent: Monday, April 23, 2012 3:20 PM > Subject: Re: [Cppcms-users] Advice on debugging file upload > > I've been following this discussion and I ran the same test on FreeBSD 8 > and it only prints "My Error", but no trace. > > Petr > >>> ~/src/cppcms-1.0.1/mybuild$ ./a.out >>> My Error >>> 0x107963102: booster::backtrace::backtrace(unsigned long) + 0x76 in >>> /Users/douglivesey/src/cppcms-1.0.1/mybuild/./a.out >>> 0x1079632c9: booster::runtime_error::runtime_error(std::string > const&) + >>> 0x39 in /Users/douglivesey/src/cppcms-1.0.1/mybuild/./a.out >>> 0x107962eda: foo() + 0x4a in >>> /Users/douglivesey/src/cppcms-1.0.1/mybuild/./a.out >>> 0x107962f4a: bar() + 0x9 in >>> /Users/douglivesey/src/cppcms-1.0.1/mybuild/./a.out >>> 0x107962f5d: main + 0xe in >>> /Users/douglivesey/src/cppcms-1.0.1/mybuild/./a.out >>> 0x107962e88: start + 0x34 in >>> /Users/douglivesey/src/cppcms-1.0.1/mybuild/./a.out >> >> >> Ok, the stack backtrace works on Mac OS X. >> >> >> If so you should probably see where exactly the exception comes from in >> the >> log - including cppcms::widgers::file::value() in the stack trace. >> >> Use it, it is very powerful tool. >> >> (Don't forget -dynamic options) >> >> Artyom >> >> >> > ------------------------------------------------------------------------------ >> For Developers, A Lot Can Happen In A Second. >> Boundary is the first to Know...and Tell You. >> Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! >> http://p.sf.net/sfu/Boundary-d2dvs2 >> _______________________________________________ >> Cppcms-users mailing list >> Cpp...@li... >> https://lists.sourceforge.net/lists/listinfo/cppcms-users >> > > > > ------------------------------------------------------------------------------ > For Developers, A Lot Can Happen In A Second. > Boundary is the first to Know...and Tell You. > Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! > http://p.sf.net/sfu/Boundary-d2dvs2 > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
From: <ele...@ex...> - 2012-04-23 12:59:56
|
Are you referring to this library? http://www.freebsd.org/cgi/url.cgi?ports/devel/libexecinfo/pkg-descr > Unfortunately FreeBSD does not provide such API, so it is not possible > to create safe backtrace - the existing execinfo.h library that > comes with FreeBSD is not safe when using with "omit-frame-pointer" > optimization. > > If you find any other suitable way to create a backtrace (at least > backtrace - not backtrace_symbols) > it would be possible to provide stack tracing for FreeBSD as well. |
From: Artyom B. <art...@ya...> - 2012-04-23 13:21:26
|
Yes... It uses __builtin_return_address and __builtin_frame_address and they are not really safe functions http://gcc.gnu.org/onlinedocs/gcc/Return-Address.html So for this reason I really prefer to not use libexecinfo under FreeBSD. Other implementations (like GNU Libc for example) use an information about the stack bottom to prevent running out of the stack frame and creating access violation. So unless it would be proven otherwise libexecinfo is not in use under FreeBSD. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ ----- Original Message ----- > From: "ele...@ex..." <ele...@ex...> > To: Artyom Beilis <art...@ya...>; cpp...@li... > Cc: > Sent: Monday, April 23, 2012 3:59 PM > Subject: Re: [Cppcms-users] Advice on debugging file upload > > Are you referring to this library? > > http://www.freebsd.org/cgi/url.cgi?ports/devel/libexecinfo/pkg-descr > >> Unfortunately FreeBSD does not provide such API, so it is not possible >> to create safe backtrace - the existing execinfo.h library that >> comes with FreeBSD is not safe when using with > "omit-frame-pointer" >> optimization. >> >> If you find any other suitable way to create a backtrace (at least >> backtrace - not backtrace_symbols) >> it would be possible to provide stack tracing for FreeBSD as well. > > > ------------------------------------------------------------------------------ > For Developers, A Lot Can Happen In A Second. > Boundary is the first to Know...and Tell You. > Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! > http://p.sf.net/sfu/Boundary-d2dvs2 > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
From: doug l. <bi...@gm...> - 2012-04-23 19:14:01
|
Ah, so it looks like my issue is something else -- my form isn't even getting loaded. For completeness, I have a simple context object: https://github.com/biot023/improc/blob/master/content.h And I have a simple server: https://github.com/biot023/improc/blob/master/imageserver.cpp#L32 And I'm testing the server with this call to cURL: $ curl localhost:8080/imageserver/abc -F file=@features/fixtures/img01.jpg -F key=def The response is a 500, and the error that cppcms logs to cerr is this: 2012-04-23 20:07:57; cppcms, error: Caught exception [Value was not loaded] 0x10653d2b3: cppcms::cppcms_error::cppcms_error(std::string const&) + 0x63 in /usr/local/lib/libcppcms.1.dylib (http_context.cpp:139) The error is caused by the highlighted line in the imageserver.cpp file. >From my reading of the tutorials, the create() member function should be loading the form from the context(), but obviously it isn't, so obviously I'm missing something. Can anyone maybe see where I'm going wrong / what I'm failing to do? & thanks again for all the help, it's really appreciated. Doug. |
From: Artyom B. <art...@ya...> - 2012-04-23 19:58:06
|
Read: http://cppcms.com/wikipp/en/page/cppcms_1x_forms Your widgets are not registered withing the form Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >________________________________ > From: doug livesey <bi...@gm...> >To: Artyom Beilis <art...@ya...>; cpp...@li... >Sent: Monday, April 23, 2012 10:13 PM >Subject: Re: [Cppcms-users] Advice on debugging file upload > > >Ah, so it looks like my issue is something else -- my form isn't even getting loaded. >For completeness, I have a simple context object: https://github.com/biot023/improc/blob/master/content.h >And I have a simple server: https://github.com/biot023/improc/blob/master/imageserver.cpp#L32 >And I'm testing the server with this call to cURL: > $ curl localhost:8080/imageserver/abc -F file=@features/fixtures/img01.jpg -F key=def > > >The response is a 500, and the error that cppcms logs to cerr is this: > 2012-04-23 20:07:57; cppcms, error: Caught exception [Value was not loaded] > 0x10653d2b3: cppcms::cppcms_error::cppcms_error(std::string const&) + 0x63 in /usr/local/lib/libcppcms.1.dylib > (http_context.cpp:139) > > >The error is caused by the highlighted line in the imageserver.cpp file. >From my reading of the tutorials, the create() member function should be loading the form from the context(), but obviously it isn't, so obviously I'm missing something. >Can anyone maybe see where I'm going wrong / what I'm failing to do? >& thanks again for all the help, it's really appreciated. > Doug. > > >------------------------------------------------------------------------------ >For Developers, A Lot Can Happen In A Second. >Boundary is the first to Know...and Tell You. >Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! >http://p.sf.net/sfu/Boundary-d2dvs2 > >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |
From: doug l. <bi...@gm...> - 2012-04-24 17:33:43
|
Ah, that got rid of that error, thankyou! Unfortunately, I'm still not getting any content for the file, and when I try to output the value of the form's key widget, I'm getting an empty string, even though the call to cURL explicitly sets the value. Could this be because I'm using cURL? & sorry to be spamming the list with this -- I'll be good & quiet when I've got the hang of everything, honest. ;) Doug. On 23 April 2012 20:57, Artyom Beilis <art...@ya...> wrote: > Read: http://cppcms.com/wikipp/en/page/cppcms_1x_forms > > Your widgets are not registered withing the form > > Artyom Beilis > -------------- > CppCMS - C++ Web Framework: http://cppcms.com/ > CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > ------------------------------ > *From:* doug livesey <bi...@gm...> > *To:* Artyom Beilis <art...@ya...>; > cpp...@li... > *Sent:* Monday, April 23, 2012 10:13 PM > > *Subject:* Re: [Cppcms-users] Advice on debugging file upload > > Ah, so it looks like my issue is something else -- my form isn't even > getting loaded. > For completeness, I have a simple context object: > https://github.com/biot023/improc/blob/master/content.h > And I have a simple server: > https://github.com/biot023/improc/blob/master/imageserver.cpp#L32 > And I'm testing the server with this call to cURL: > $ curl localhost:8080/imageserver/abc -F > file=@features/fixtures/img01.jpg -F key=def > > The response is a 500, and the error that cppcms logs to cerr is this: > 2012-04-23 20:07:57; cppcms, error: Caught exception [Value was not > loaded] > 0x10653d2b3: cppcms::cppcms_error::cppcms_error(std::string const&) + > 0x63 in /usr/local/lib/libcppcms.1.dylib > (http_context.cpp:139) > > The error is caused by the highlighted line in the imageserver.cpp file. > From my reading of the tutorials, the create() member function should be > loading the form from the context(), but obviously it isn't, so obviously > I'm missing something. > Can anyone maybe see where I'm going wrong / what I'm failing to do? > & thanks again for all the help, it's really appreciated. > Doug. > > > > ------------------------------------------------------------------------------ > For Developers, A Lot Can Happen In A Second. > Boundary is the first to Know...and Tell You. > Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! > http://p.sf.net/sfu/Boundary-d2dvs2 > > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > > ------------------------------------------------------------------------------ > For Developers, A Lot Can Happen In A Second. > Boundary is the first to Know...and Tell You. > Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! > http://p.sf.net/sfu/Boundary-d2dvs2 > > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > |
From: <ele...@ex...> - 2012-04-24 11:06:02
|
> Yes... > > It uses __builtin_return_address and __builtin_frame_address > and they are not really safe functions > > > http://gcc.gnu.org/onlinedocs/gcc/Return-Address.html What kind of results/problems can I expect if I modify booster::backtrace to compile against libexecinfo from FreeBSD? Petr |
From: Artyom B. <art...@ya...> - 2012-04-24 11:35:40
|
>> Yes... >> >> It uses __builtin_return_address and __builtin_frame_address >> and they are not really safe functions >> >> >> http://gcc.gnu.org/onlinedocs/gcc/Return-Address.html > > >What kind of results/problems can I expect if I modify booster::backtrace >to compile against libexecinfo from FreeBSD? > I actually did it once we talked (may be I missed something). Once the program is compiled with -fomit-frame-pointer you do not get stack trace at all, and this is default at optimization levels -O1 and above starting from gcc-4.6 So once I changed it actually worked - got stack trace (with gcc-4.2) but once gcc is upgraded it would be usless and I assume it may also be dangerous. If you want I can send you a patch (I prepared it as I seen that many programs actually use libexecinfo) but I don't think I want it in the mainstream. Artyom |
From: <ele...@ex...> - 2012-04-24 12:21:53
|
That would be great. Do you know what's the defaults on clang as FreeBSD is moving away from GCC slowly? > If you want I can send you a patch (I prepared it as I seen that many > programs actually use libexecinfo) but I don't think I > want it in the mainstream. > > > Artyom > |
From: Artyom B. <art...@ya...> - 2012-04-24 12:57:17
Attachments:
freebsd.patch
|
Take it. If it moves to Clang than probably I'll be able to add it. However I don't know if clang uses "omit-frame-pointer" optimization. See if it works for you, also don't forget that you need -rdynamic option for the code then compile. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ ----- Original Message ----- > From: "ele...@ex..." <ele...@ex...> > To: Artyom Beilis <art...@ya...>; cpp...@li... > Cc: > Sent: Tuesday, April 24, 2012 3:21 PM > Subject: Re: [Cppcms-users] Advice on debugging file upload > >T hat would be great. Do you know what's the defaults on clang as FreeBSD > is moving away from GCC slowly? > > >> If you want I can send you a patch (I prepared it as I seen that many >> programs actually use libexecinfo) but I don't think I >> want it in the mainstream. >> >> >> Artyom >> > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
From: Artyom B. <art...@ya...> - 2012-04-24 18:15:30
|
Instead doing this all over again start from there: http://cppcms.com/cppcms_ref/latest/ex_uploads.html I don't know what is your problem, most likely you don't send files properly Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > >>________________________________ >> From: doug livesey <bi...@gm...> >>To: Artyom Beilis <art...@ya...>; cpp...@li... >>Sent: Tuesday, April 24, 2012 8:33 PM >>Subject: Re: [Cppcms-users] Advice on debugging file upload >> >> >>Ah, that got rid of that error, thankyou! >>Unfortunately, I'm still not getting any content for the file, and when I try to output the value of the form's key widget, I'm getting an empty string, even though the call to cURL explicitly sets the value. >>Could this be because I'm using cURL? >>& sorry to be spamming the list with this -- I'll be good & quiet when I've got the hang of everything, honest. ;) >> Doug. >> >> >>On 23 April 2012 20:57, Artyom Beilis <art...@ya...> wrote: >> >>Read: http://cppcms.com/wikipp/en/page/cppcms_1x_forms >>> >>> >>>Your widgets are not registered withing the form >>> >>>Artyom Beilis >>>-------------- >>>CppCMS - C++ Web Framework: http://cppcms.com/ >>>CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >>> >>> >>> >>>>________________________________ >>>> From: doug livesey <bi...@gm...> >>>> >>>>To: Artyom Beilis <art...@ya...>; cpp...@li... >>>>Sent: Monday, April 23, 2012 10:13 PM >>>> >>>>Subject: Re: [Cppcms-users] Advice on debugging file upload >>>> >>>> >>>>Ah, so it looks like my issue is something else -- my form isn't even getting loaded. >>>>For completeness, I have a simple context object: https://github.com/biot023/improc/blob/master/content.h >>>>And I have a simple server: https://github.com/biot023/improc/blob/master/imageserver.cpp#L32 >>>>And I'm testing the server with this call to cURL: >>>> $ curl localhost:8080/imageserver/abc -F file=@features/fixtures/img01.jpg -F key=def >>>> >>>> >>>>The response is a 500, and the error that cppcms logs to cerr is this: >>>> 2012-04-23 20:07:57; cppcms, error: Caught exception [Value was not loaded] >>>> 0x10653d2b3: cppcms::cppcms_error::cppcms_error(std::string const&) + 0x63 in /usr/local/lib/libcppcms.1.dylib >>>> (http_context.cpp:139) >>>> >>>> >>>>The error is caused by the highlighted line in the imageserver.cpp file. >>>>From my reading of the tutorials, the create() member function should be loading the form from the context(), but obviously it isn't, so obviously I'm missing something. >>>>Can anyone maybe see where I'm going wrong / what I'm failing to do? >>>>& thanks again for all the help, it's really appreciated. >>>> Doug. >>>> >>>> >>>> >>>>------------------------------------------------------------------------------ >>>>For Developers, A Lot Can Happen In A Second. >>>>Boundary is the first to Know...and Tell You. >>>>Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! >>>>http://p.sf.net/sfu/Boundary-d2dvs2 >>>> >>>>_______________________________________________ >>>>Cppcms-users mailing list >>>>Cpp...@li... >>>>https://lists.sourceforge.net/lists/listinfo/cppcms-users >>>> >>>> >>>> >>>------------------------------------------------------------------------------ >>>For Developers, A Lot Can Happen In A Second. >>>Boundary is the first to Know...and Tell You. >>>Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! >>>http://p.sf.net/sfu/Boundary-d2dvs2 >>> >>>_______________________________________________ >>>Cppcms-users mailing list >>>Cpp...@li... >>>https://lists.sourceforge.net/lists/listinfo/cppcms-users >>> >>> >> >>------------------------------------------------------------------------------ >>Live Security Virtual Conference >>Exclusive live event will cover all the ways today's security and >>threat landscape has changed and how IT managers can respond. Discussions >>will include endpoint security, mobile security and the latest in malware >>threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >>_______________________________________________ >>Cppcms-users mailing list >>Cpp...@li... >>https://lists.sourceforge.net/lists/listinfo/cppcms-users >> >> >> > > |
From: doug l. <bi...@gm...> - 2012-04-24 19:28:32
|
Yeah, that's what I guessed -- thanks for having a look. I'll create a form in cppcms to upload the file from & see if that works. If it does, is there an easy way to inspect the request data, to try to work out what is different? & thanks again, Doug. On 24 April 2012 19:15, Artyom Beilis <art...@ya...> wrote: > > > > > Instead doing this all over again start from there: > > > > http://cppcms.com/cppcms_ref/latest/ex_uploads.html > > > I don't know what is your problem, most likely you don't send files > properly > > > > Artyom Beilis > -------------- > CppCMS - C++ Web Framework: http://cppcms.com/ > CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > > > > > >>________________________________ > >> From: doug livesey <bi...@gm...> > >>To: Artyom Beilis <art...@ya...>; > cpp...@li... > >>Sent: Tuesday, April 24, 2012 8:33 PM > >>Subject: Re: [Cppcms-users] Advice on debugging file upload > >> > >> > >>Ah, that got rid of that error, thankyou! > >>Unfortunately, I'm still not getting any content for the file, and when > I try to output the value of the form's key widget, I'm getting an empty > string, even though the call to cURL explicitly sets the value. > >>Could this be because I'm using cURL? > >>& sorry to be spamming the list with this -- I'll be good & quiet when > I've got the hang of everything, honest. ;) > >> Doug. > >> > >> > >>On 23 April 2012 20:57, Artyom Beilis <art...@ya...> wrote: > >> > >>Read: http://cppcms.com/wikipp/en/page/cppcms_1x_forms > >>> > >>> > >>>Your widgets are not registered withing the form > >>> > >>>Artyom Beilis > >>>-------------- > >>>CppCMS - C++ Web Framework: http://cppcms.com/ > >>>CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > >>> > >>> > >>> > >>>>________________________________ > >>>> From: doug livesey <bi...@gm...> > >>>> > >>>>To: Artyom Beilis <art...@ya...>; > cpp...@li... > >>>>Sent: Monday, April 23, 2012 10:13 PM > >>>> > >>>>Subject: Re: [Cppcms-users] Advice on debugging file upload > >>>> > >>>> > >>>>Ah, so it looks like my issue is something else -- my form isn't even > getting loaded. > >>>>For completeness, I have a simple context object: > https://github.com/biot023/improc/blob/master/content.h > >>>>And I have a simple server: > https://github.com/biot023/improc/blob/master/imageserver.cpp#L32 > >>>>And I'm testing the server with this call to cURL: > >>>> $ curl localhost:8080/imageserver/abc -F > file=@features/fixtures/img01.jpg -F key=def > >>>> > >>>> > >>>>The response is a 500, and the error that cppcms logs to cerr is this: > >>>> 2012-04-23 20:07:57; cppcms, error: Caught exception [Value was not > loaded] > >>>> 0x10653d2b3: cppcms::cppcms_error::cppcms_error(std::string const&) > + 0x63 in /usr/local/lib/libcppcms.1.dylib > >>>> (http_context.cpp:139) > >>>> > >>>> > >>>>The error is caused by the highlighted line in the imageserver.cpp > file. > >>>>From my reading of the tutorials, the create() member function should > be loading the form from the context(), but obviously it isn't, so > obviously I'm missing something. > >>>>Can anyone maybe see where I'm going wrong / what I'm failing to do? > >>>>& thanks again for all the help, it's really appreciated. > >>>> Doug. > >>>> > >>>> > >>>> > > >>>>------------------------------------------------------------------------------ > >>>>For Developers, A Lot Can Happen In A Second. > >>>>Boundary is the first to Know...and Tell You. > >>>>Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! > >>>>http://p.sf.net/sfu/Boundary-d2dvs2 > >>>> > >>>>_______________________________________________ > >>>>Cppcms-users mailing list > >>>>Cpp...@li... > >>>>https://lists.sourceforge.net/lists/listinfo/cppcms-users > >>>> > >>>> > >>>> > > >>>------------------------------------------------------------------------------ > >>>For Developers, A Lot Can Happen In A Second. > >>>Boundary is the first to Know...and Tell You. > >>>Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! > >>>http://p.sf.net/sfu/Boundary-d2dvs2 > >>> > >>>_______________________________________________ > >>>Cppcms-users mailing list > >>>Cpp...@li... > >>>https://lists.sourceforge.net/lists/listinfo/cppcms-users > >>> > >>> > >> > > >>------------------------------------------------------------------------------ > >>Live Security Virtual Conference > >>Exclusive live event will cover all the ways today's security and > >>threat landscape has changed and how IT managers can respond. Discussions > >>will include endpoint security, mobile security and the latest in malware > >>threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > >>_______________________________________________ > >>Cppcms-users mailing list > >>Cpp...@li... > >>https://lists.sourceforge.net/lists/listinfo/cppcms-users > >> > >> > >> > > > > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
From: doug l. <bi...@gm...> - 2012-04-24 21:16:15
|
Ah, I have it -- it looks like there's some cppcms magic involved in constructing and handling forms. The fields "owner" and "data" in my form got translated in the markup into inputs with the non-natural names "_1" and "_2", like so: <form method="post" action=""> <p><span class="cppcms_form_input"><input type="file" name="_1" ></span></p> <p><span class="cppcms_form_input"><input type="text" name="_2" value="Ding" ></span></p> <p><span class="cppcms_form_input"><input type="submit" name="_3" value=" Upload" ></span></p> </form> And when I replicated this with cURL like so: $ curl localhost:8080/imageserver/abc -F _1="def" -F _2=@features/fixtures/img01.jpg It worked. So now I need to figure out how to submit a form to cppcms with fields named in a more natural manner, not "_1", "_2", etc. Which is progress! :) Cheers, Doug. |
From: <ele...@ex...> - 2012-05-02 02:00:37
|
Hi Artyom, Ive recompiled booster with your patch, but im still not getting a trace when cppcms/cppdb throws - such as 2012-05-02 11:52:57; cppcms, error: Caught exception [cppdb::invalid_column attempt access to invalid column] (http_context.cpp:139 I would have assumed that it will show me trace so I can find out which line tries to access the invalid column. > g++ -dynamic -O0 lib/backtrace/test/test_backtrace.cpp -L/usr/local/lib -lbooster -I/usr/local/include > ./a.out My Error 0x403270: booster::runtime_error::runtime_error(std::string const&) + 0x30 in /usr/home/petr/Downloads/cppcms-1.0.0/booster/a.out 0x401cf2: _init + 0x60a in /usr/home/petr/Downloads/cppcms-1.0.0/booster/a.out 0x401da9: _init + 0x6c1 in /usr/home/petr/Downloads/cppcms-1.0.0/booster/a.out 0x401dbe: _init + 0x6d6 in /usr/home/petr/Downloads/cppcms-1.0.0/booster/a.out 0x4019fe: _init + 0x316 in /usr/home/petr/Downloads/cppcms-1.0.0/booster/a.out Petr |
From: Artyom B. <art...@ya...> - 2012-05-02 19:23:52
|
In order to get a trace the exception that is thrown should be derived from booster::runtime_error class. CppDB is independent library that does not share the stack trace code with CppCMS, that is why you can't get a backtrace from CppDB. It is not supported. Also I'd recommend to use latest trunk, it has better support for backtracing (not based on execinfo) that works on BSD and Mac OS X as well Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ ----- Original Message ----- > From: "ele...@ex..." <ele...@ex...> > To: Artyom Beilis <art...@ya...>; cpp...@li... > Cc: > Sent: Wednesday, May 2, 2012 5:00 AM > Subject: Re: [Cppcms-users] Advice on debugging file upload > > Hi Artyom, > > Ive recompiled booster with your patch, but im still not getting a trace > when cppcms/cppdb throws - such as > > 2012-05-02 11:52:57; cppcms, error: Caught exception > [cppdb::invalid_column attempt access to invalid column] > (http_context.cpp:139 > > I would have assumed that it will show me trace so I can find out which > line tries to access the invalid column. > >> g++ -dynamic -O0 lib/backtrace/test/test_backtrace.cpp -L/usr/local/lib > -lbooster -I/usr/local/include >> ./a.out > My Error > 0x403270: booster::runtime_error::runtime_error(std::string const&) + 0x30 > in /usr/home/petr/Downloads/cppcms-1.0.0/booster/a.out > 0x401cf2: _init + 0x60a in > /usr/home/petr/Downloads/cppcms-1.0.0/booster/a.out > 0x401da9: _init + 0x6c1 in > /usr/home/petr/Downloads/cppcms-1.0.0/booster/a.out > 0x401dbe: _init + 0x6d6 in > /usr/home/petr/Downloads/cppcms-1.0.0/booster/a.out > 0x4019fe: _init + 0x316 in > /usr/home/petr/Downloads/cppcms-1.0.0/booster/a.out > > > Petr > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |