MinGW Crash in serialization during Client request

Forum for posting problems using QxOrm library

MinGW Crash in serialization during Client request

Postby SteveW » Thu Mar 17, 2016 1:57 am

Hi,

Many many thanks for your helps (and Beta updates so far to help with the problems I'm encountering). To date, I now have a working MSVC 2013 build (in both Debug and Release) of our Client/Server QxORM project using a Model/View UI client application.

You will already be aware of our project and that it using almost every QxORM feature, so it is testing things to the limit.

I have a working MSVC 2013 build, but I am the only developer on the team using MSVC 2013, the other developers are using QtCreator with the gcc/MinGW compiler, so we must have this build configuration working too.

I have built all the required boost serialization DLL's for gcc, and the gcc QxORM DLL's build fine, and (using the -O2 compiler switch in to keep object/dll size below the limits to avoid linker crashes!) finally our QxORM generated project all compiles fine.

When executing the build, the Server program will runs ok, loads the Server's service, and waits for a client request. Great!

However the client crashes in the boost serialization code as it is attempting to (I think!) serialize the "fetch_all" request down the socket. Call stack is...

Code: Select all
0   ??         0x2748ec40   
1   boost::archive::detail::basic_oarchive::save_object   basic_oarchive.cpp   427   0x2901c59   
2   qx::QxDataMember<std::shared_ptr<customer_main_record>, services::customer_main_record_input>::toArchive(void const *, boost::archive::xml_oarchive&) const         0x6c04ad1f   
3   boost::archive::detail::oserializer<boost::archive::xml_oarchive, services::customer_main_record_input>::save_object_data(boost::archive::detail::basic_oarchive&, void const *) const         0x6c15b7f7   
4   boost::archive::detail::basic_oarchive_impl::save_object   basic_oarchive.cpp   254   0x2922863   
5   boost::archive::detail::basic_oarchive::save_object   basic_oarchive.cpp   427   0x2901c59   
6   boost::archive::detail::pointer_oserializer<boost::archive::xml_oarchive, services::customer_main_record_input>::save_object_ptr(boost::archive::detail::basic_oarchive&, void const *) const         0x6c1bd681   
7   boost::archive::detail::basic_oarchive_impl::save_pointer   basic_oarchive.cpp   397   0x29231f1   
8   boost::archive::detail::basic_oarchive::save_pointer   basic_oarchive.cpp   435   0x2901c93   
9   boost::archive::detail::save_pointer_type<boost::archive::xml_oarchive>::polymorphic::save<qx::service::IxParameter>   oserializer.hpp   444   0x63e002ab   
10   boost::archive::detail::save_pointer_type<boost::archive::xml_oarchive>::save<qx::service::IxParameter>   oserializer.hpp   460   0x63e00402   
11   boost::archive::detail::save_pointer_type<boost::archive::xml_oarchive>::invoke<qx::service::IxParameter const *>   oserializer.hpp   473   0x63e004b1   
12   boost::archive::save<boost::archive::xml_oarchive, qx::service::IxParameter const * const>   oserializer.hpp   525   0x63df36ce   
13   boost::archive::detail::common_oarchive<boost::archive::xml_oarchive>::save_override<qx::service::IxParameter const * const>   common_oarchive.hpp   69   0x63dfdd58   
14   boost::archive::basic_xml_oarchive<boost::archive::xml_oarchive>::save_override<qx::service::IxParameter const *>   basic_xml_oarchive.hpp   109   0x63debeb2   
15   boost::archive::detail::interface_oarchive<boost::archive::xml_oarchive>::operator<< <boost::serialization::nvp<qx::service::IxParameter const *>>   interface_oarchive.hpp   70   0x63e03cd6   
16   boost::serialization::save<boost::archive::xml_oarchive, qx::service::IxParameter>   shared_ptr.hpp   236   0x63db69b7   
17   boost::serialization::free_saver<boost::archive::xml_oarchive, std::shared_ptr<qx::service::IxParameter>>::invoke   split_free.hpp   45   0x63da5e07   
18   boost::serialization::split_free<boost::archive::xml_oarchive, std::shared_ptr<qx::service::IxParameter>>   split_free.hpp   74   0x63da6f1f   
19   boost::serialization::serialize<boost::archive::xml_oarchive, qx::service::IxParameter>   shared_ptr.hpp   273   0x63dd1773   
20   boost::serialization::serialize_adl<boost::archive::xml_oarchive, std::shared_ptr<qx::service::IxParameter>>   serialization.hpp   126   0x63daae3b   
21   boost::archive::detail::oserializer<boost::archive::xml_oarchive, std::shared_ptr<qx::service::IxParameter>>::save_object_data   oserializer.hpp   148   0x63e2a278   
22   boost::archive::detail::basic_oarchive_impl::save_object   basic_oarchive.cpp   274   0x29229d2   
23   boost::archive::detail::basic_oarchive::save_object   basic_oarchive.cpp   427   0x2901c59   
24   boost::archive::detail::save_non_pointer_type<boost::archive::xml_oarchive>::save_standard::invoke<std::shared_ptr<qx::service::IxParameter>>   oserializer.hpp   253   0x63e0b5e9   
25   boost::archive::detail::save_non_pointer_type<boost::archive::xml_oarchive>::invoke<std::shared_ptr<qx::service::IxParameter>>   oserializer.hpp   308   0x63e0bc11   
26   boost::archive::save<boost::archive::xml_oarchive, std::shared_ptr<qx::service::IxParameter> const>   oserializer.hpp   525   0x63df3720   
27   boost::archive::detail::common_oarchive<boost::archive::xml_oarchive>::save_override<std::shared_ptr<qx::service::IxParameter> const>   common_oarchive.hpp   69   0x63dfddd0   
28   boost::archive::basic_xml_oarchive<boost::archive::xml_oarchive>::save_override<std::shared_ptr<qx::service::IxParameter>>   basic_xml_oarchive.hpp   109   0x63dec002   
29   boost::archive::detail::interface_oarchive<boost::archive::xml_oarchive>::operator<< <boost::serialization::nvp<std::shared_ptr<qx::service::IxParameter>>>   interface_oarchive.hpp   70   0x63e03d72   
30   boost::serialization::qx_save<boost::archive::xml_oarchive>   QxTransaction.cpp   236   0x63dcd0f7   
31   boost::serialization::save   QxTransaction.cpp   295   0x63d6ce47   
32   boost::serialization::free_saver<boost::archive::xml_oarchive, qx::service::QxTransaction>::invoke   split_free.hpp   45   0x63da5d47   
33   boost::serialization::split_free<boost::archive::xml_oarchive, qx::service::QxTransaction>   split_free.hpp   74   0x63da6eb3   
34   boost::serialization::serialize<boost::archive::xml_oarchive>   QxTransaction.h   195   0x63dd169b   
35   boost::serialization::serialize_adl<boost::archive::xml_oarchive, qx::service::QxTransaction>   serialization.hpp   126   0x63daad3b   
36   boost::archive::detail::oserializer<boost::archive::xml_oarchive, qx::service::QxTransaction>::save_object_data   oserializer.hpp   148   0x63e29f8c   
37   boost::archive::detail::basic_oarchive_impl::save_object   basic_oarchive.cpp   292   0x2922b15   
38   boost::archive::detail::basic_oarchive::save_object   basic_oarchive.cpp   427   0x2901c59   
39   boost::archive::detail::save_non_pointer_type<boost::archive::xml_oarchive>::save_standard::invoke<qx::service::QxTransaction>   oserializer.hpp   253   0x63e0b549   
40   boost::archive::detail::save_non_pointer_type<boost::archive::xml_oarchive>::invoke<qx::service::QxTransaction>   oserializer.hpp   308   0x63e0bb71   
41   boost::archive::save<boost::archive::xml_oarchive, qx::service::QxTransaction const>   oserializer.hpp   525   0x63df365c   
42   boost::archive::detail::common_oarchive<boost::archive::xml_oarchive>::save_override<qx::service::QxTransaction const>   common_oarchive.hpp   69   0x63dfdcb8   
43   boost::archive::basic_xml_oarchive<boost::archive::xml_oarchive>::save_override<qx::service::QxTransaction const>   basic_xml_oarchive.hpp   109   0x63deba52   
44   boost::archive::detail::interface_oarchive<boost::archive::xml_oarchive>::operator<< <boost::serialization::nvp<qx::service::QxTransaction const>>   interface_oarchive.hpp   70   0x63e03ace   
45   qx::QxArchive_ToByteArray<qx::service::QxTransaction, boost::archive::xml_iarchive, boost::archive::xml_oarchive>::toByteArray   QxArchive.inl   210   0x63d84e02   
46   qx::serialization::xml::to_byte_array<qx::service::QxTransaction>   QxArchive.h   202   0x63d83ef2   
47   qx::service::QxTools::writeSocket   QxTools.cpp   138   0x63d6a015   
48   qx::service::QxTransaction::writeSocket   QxTransaction.cpp   129   0x63d6c97f   
49   qx::service::QxTransaction::executeClient   QxTransaction.cpp   113   0x63d6c4eb   
50   qx::service::execute_client   QxTransaction.cpp   184   0x63d6cd73   
51   services::customer_main_record_services::fetchAll_()         0x6ba0df60   
52   services::customer_main_record_services::fetchAll(std::shared_ptr<qx::QxCollection<long, std::shared_ptr<customer_main_record>>>&, QStringList const&, QStringList const&)         0x6ba1079b   
53   qx::QxModelService<customer_main_record, services::customer_main_record_services>::qxFetchAll   QxModelService.h   117   0x406184   
54   qx::IxModel::qxFetchAll_   IxModel.cpp   126   0x63d73866   
55   qMain   main.cpp   24   0x4017ec   
56   WinMain *16   C:/__Sum-It/Dorothy/code/crm/_build/bin-MinGW_32bit-Debug/sum-it_crm.exe   113   0x403cc0   
57   main         0x44257d   


In the QtCreator debugger, the crash results in the error message:

Code: Select all
"The inferior stopped because it received a signal from the operating system"

Signal Name: SIGSEGV
Signal meaning: Segmentation fault"


When attempting to execute

Code: Select all
pimpl->save_object(*this, x, box);


inside the basic_oarchive::save_object method.

Is there anything you can help out with on this one? It looks like a general issue with the Client request code combined with boost serialization usage to me and unrelated to either our database schema or entiries etc maybe you have a bit of knowledge that will help?

(This is in a Debug build obviously, or I would not have such detailed crash info. I have not yet built or tested a MinGW release build).

Thanks
Steve.
SteveW
 
Posts: 53
Joined: Tue Jan 19, 2016 4:12 pm

Re: MinGW Crash in serialization during Client request

Postby qxorm » Thu Mar 17, 2016 11:56 am

Hello,

I now have a working MSVC 2013 build (in both Debug and Release) of our Client/Server QxORM project using a Model/View UI client application.

Great !

the client crashes in the boost serialization code as it is attempting to (I think!) serialize the "fetch_all" request down the socket.

Not exactly : your instance is serialized, then the serialized stream is passed to the socket.
Your error is in the boost serialization process, so this is not a network or socket problem.

I think the problem could come from :
- boost ;
- or MinGW ;
- or an incompatibility between your boost version and your MinGW version.

Have you tried to use Qt serialization (binary or JSON) instead of boost serialization ?

Just write this line on client side and server side :
Code: Select all
qx::service::QxConnect::getSingleton()->setSerializationType(qx::service::QxConnect::serialization_qt);

Or for JSON :
Code: Select all
qx::service::QxConnect::getSingleton()->setSerializationType(qx::service::QxConnect::serialization_json);


I have improved the Qt serialization process in QxOrm 1.4.2 so this is an option you should consider.
qxorm
Site Admin
 
Posts: 481
Joined: Mon Apr 12, 2010 7:45 am

Re: MinGW Crash in serialization during Client request

Postby SteveW » Sat Mar 19, 2016 8:15 pm

Hi

With QxORM rebuild without Boost Serialization enabled, and my project rebuild against that QxORM lib, I now get the error:

Code: Select all
transaction_content (JSON format) :
{
    "dt_transaction_begin": "2016-03-19T20:12:27",
    "dt_transaction_end": null,
    "dt_transaction_reply_received": null,
    "dt_transaction_reply_sent": "2016-03-19T20:12:27",
    "dt_transaction_request_received": "2016-03-19T20:12:27",
    "dt_transaction_request_sent": null,
    "input_parameter": null,
    "input_transaction_size": 1344,
    "ip_source": "::1",
    "ip_target": "localhost",
    "message_return": {
        "code": 0,
        "desc": "invalid input parameter to call service 'customer_main_record_services::fetchAll()'",
        "value": false
    },
    "output_parameter": null,
    "output_transaction_size": 869,
    "port_source": 50501,
    "port_target": 7698,
    "service_method": "fetchAll",
    "service_name": "services::customer_main_record_services",
    "transaction_id": "{aa92de16-d50b-4bb0-9678-6b1d4f6b0bd9}"
}


In the server window after the client has sent the request (this happens in both "serialization_qt" and "serialization_json").
SteveW
 
Posts: 53
Joined: Tue Jan 19, 2016 4:12 pm

Re: MinGW Crash in serialization during Client request

Postby qxorm » Sun Mar 20, 2016 12:33 pm

On server side, using JSON serialization, could you please try to put a breakpoint in file ./QxOrm/src/QxSerialize/QJson/QxSerializeQJson_QxTransaction.cpp, function QxConvert_FromJson_Helper :
Code: Select all
   t.m_pInputParameter.reset();
   if (obj.contains("input_parameter_class_name"))
   {
      QString sClassName = obj.value("input_parameter_class_name").toString();
      qx::service::IxParameter * ptr = qx::create_nude_ptr<qx::service::IxParameter>(sClassName);
      if (! ptr) { qAssertMsg(false, "[QxOrm] qx::cvt::detail::QxConvert_FromJson< qx::service::QxTransaction >, loading QJson", "unable to create nude pointer for input parameter"); }
      else { ptr->registerClass(); ptr->loadFromJson(obj.value("input_parameter")); }
      t.m_pInputParameter.reset(ptr);
   }

This part of this function should deserialize your input parameter on server side, and it seems this is not the case for you.

Could you check that please ?
qxorm
Site Admin
 
Posts: 481
Joined: Mon Apr 12, 2010 7:45 am

Re: MinGW Crash in serialization during Client request

Postby SteveW » Mon Mar 21, 2016 10:27 pm

,Hi

I am on other projects at the moment, so can't follow this up straight away. I will get back to you when I get chance...

Steve.
SteveW
 
Posts: 53
Joined: Tue Jan 19, 2016 4:12 pm

Re: MinGW Crash in serialization during Client request

Postby SteveW » Sun Apr 10, 2016 11:32 pm

Hi

I am returning to this issue Tomorrow (although the actual issue now is different from the original one I posted at the start of this thread).

The issue now is: "invalid input parameter to call service 'customer_main_record_services::fetchAll()" when using the QxORM serialization code.

Also I see the Beta's I've been getting have gone public, so I will re-build/re-test with that public 1.4.2 and start a new thread if I encounter the same issue again.

Thanks,
Steve
SteveW
 
Posts: 53
Joined: Tue Jan 19, 2016 4:12 pm


Return to QxOrm - Help

Who is online

Users browsing this forum: No registered users and 14 guests