Absturz beim Senden über HID-Instanz

Mit der Version 1927fd3c schmiert IPS ab, wenn versucht wird Daten über eine HID-Instanz zu versenden.


symcon: ../res/rapidjson/include/rapidjson/document.h:853: rapidjson::GenericValue<Encoding, Allocator>::MemberIterator rapidjson::GenericValue<Encoding, Allocator>::MemberEnd() [with Encoding = rapidjson::UTF8<>; Allocator = rapidjson::MemoryPoolAllocator<>; rapidjson::GenericValue<Encoding, Allocator>::MemberIterator = rapidjson::GenericMemberIterator<false, rapidjson::UTF8<>, rapidjson::MemoryPoolAllocator<> >]: Assertion `IsObject()' failed.



#0  0x00007ffff59a6cc9 in __GI_raise (sig=sig@entry=6)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x00007ffff59aa0d8 in __GI_abort () at abort.c:89
#2  0x00007ffff599fb86 in __assert_fail_base (
    fmt=0x7ffff5af0830 "%s%s%s:%u: %s%sAssertion `%s' failed.
%n", 
    assertion=assertion@entry=0x11334e0 "IsObject()", 
    file=file@entry=0x1133200 "../res/rapidjson/include/rapidjson/document.h", 
    line=line@entry=853, 
    function=function@entry=0x12853c0 <_ZZN9rapidjson12GenericValueINS_4UTF8IcEENS_19MemoryPoolAllocatorINS_12CrtAllocatorEEEE9MemberEndEvE19__PRETTY_FUNCTION__> "rapidjson::GenericValue<Encoding, Allocator>::MemberIterator rapidjson::GenericValue<Encoding, Allocator>::MemberEnd() [with Encoding = rapidjson::UTF8<>; Allocator = rapidjson::MemoryPoolAllocator<>;"...) at assert.c:92
#3  0x00007ffff599fc32 in __GI___assert_fail (
    assertion=0x11334e0 "IsObject()", 
    file=0x1133200 "../res/rapidjson/include/rapidjson/document.h", line=853, 
    function=0x12853c0 <_ZZN9rapidjson12GenericValueINS_4UTF8IcEENS_19MemoryPoolAllocatorINS_12CrtAllocatorEEEE9MemberEndEvE19__PRETTY_FUNCTION__> "rapidjson::GenericValue<Encoding, Allocator>::MemberIterator rapidjson::GenericValue<Encoding, Allocator>::MemberEnd() [with Encoding = rapidjson::UTF8<>; Allocator = rapidjson::MemoryPoolAllocator<>;"...) at assert.c:101
#4  0x0000000000b4cecd in rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >::MemberEnd() [clone .part.160---Type <return> to continue, or q <return> to quit---
] ()
#5  0x0000000000b7022f in IPSPHPModule::SendDataToParent(std::string) ()
#6  0x0000000000c98b1b in Glue::PHP::IPS_SendDataToParent(int, _zval_struct*, _zval_struct**, _zval_struct*, int, void***) ()
#7  0x0000000000f04ff1 in zend_do_fcall_common_helper_SPEC (
    execute_data=<optimized out>, tsrm_ls=0x7fffdc1b8af0)
    at /home/symcon/php-5.5.26/Zend/zend_vm_execute.h:550
#8  0x0000000000e752e3 in execute_ex (execute_data=0x7fffdc1bc4d8, 
    tsrm_ls=0x7fffdc1b8af0)
    at /home/symcon/php-5.5.26/Zend/zend_vm_execute.h:363
#9  0x0000000000e4c8e8 in zend_execute_scripts (type=type@entry=8, 
    tsrm_ls=tsrm_ls@entry=0x7fffdc1b8af0, retval=retval@entry=0x0, 
    file_count=file_count@entry=3) at /home/symcon/php-5.5.26/Zend/zend.c:1327
#10 0x0000000000de9c1a in php_execute_script (primary_file=0x7fffd3ff4ce0, 
    tsrm_ls=0x7fffdc1b8af0) at /home/symcon/php-5.5.26/main/main.c:2525
#11 0x0000000000cd1945 in IPSScriptEngine::RunScriptTextWaitEx(std::string, std::unordered_map<std::string, boost::variant<bool, int, double, std::string>, std::hash<std::string>, std::equal_to<std::string>, std::allocator<std::pair<std::string const, boost::variant<bool, int, double, std::string> > > >) ()
#12 0x0000000000c2f657 in IPSScriptEngine::RunScriptTextWait(std::string) ()
#13 0x0000000000b4f8f1 in IPSPHPModule::RequestAction(std::string, boost::variant<bool, int, double, std::string>) ()
#14 0x0000000000691268 in WebFrontConfigurator::Execute(unsigned short, unsigned---Type <return> to continue, or q <return> to quit---
 short, boost::variant<bool, int, double, std::string>) ()
#15 0x0000000000a201b5 in Glue::RPC::WFC_Execute(IIPSKernelEx*, rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> > const&, rapidjson::GenericDocument<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>, rapidjson::CrtAllocator>*&) ()
#16 0x0000000000b1a0aa in IPSDataServer::InvokeMethod(std::string, rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> > const&, rapidjson::GenericDocument<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>, rapidjson::CrtAllocator>*&) ()
#17 0x0000000000b2212c in IPSDataServer::HandleRPCRequest(std::ostream&, std::shared_ptr<SimpleWeb::Request<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> > > >) ()
#18 0x0000000000b239da in std::_Function_handler<void (std::ostream&, std::shared_ptr<SimpleWeb::Request<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> > > >), IPSDataServer::MessageSink(IPSMessage const&)::{lambda(std::ostream&, std::shared_ptr<SimpleWeb::Request<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> > > >)#2}>::_M_invoke(std::_Any_data const&, std::ostream&, std::shared_ptr<SimpleWeb::Request<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> > > >) ()
#19 0x0000000000584e39 in SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> ---Type <return> to continue, or q <return> to quit---
> >::write_response(std::shared_ptr<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> > >, std::shared_ptr<SimpleWeb::Request<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> > > >)::{lambda(std::function<void (std::ostream&, std::shared_ptr<SimpleWeb::Request<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> > > >)>)#1}::operator()(std::function<void (std::ostream&, std::shared_ptr<SimpleWeb::Request<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> > > >)>) const
    ()
#20 0x0000000000585526 in SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> > >::write_response(std::shared_ptr<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> > >, std::shared_ptr<SimpleWeb::Request<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> > > >) ()
#21 0x000000000058582d in SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> > >::read_request_and_content(std::shared_ptr<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> > >)::{lambda(boost::system::error_code const&, unsigned long)#1}::operator()(boost::system::error_code const&, unsigned long) const::{lambda(boost::system::error_code const&, unsigned long)#1}::operator()(boost::system::error_code const&, un---Type <return> to continue, or q <return> to quit---
signed long) const ()
#22 0x0000000000585dc6 in boost::asio::detail::read_streambuf_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, std::allocator<char>, boost::asio::detail::transfer_exactly_t, SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> > >::read_request_and_content(std::shared_ptr<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> > >)::{lambda(boost::system::error_code const&, unsigned long)#1}::operator()(boost::system::error_code const&, unsigned long) const::{lambda(boost::system::error_code const&, unsigned long)#1}>::operator()(boost::system::error_code const&, unsigned long, int) ()
#23 0x0000000000585fe3 in boost::asio::detail::reactive_socket_recv_op<boost::asio::mutable_buffers_1, boost::asio::detail::read_streambuf_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, std::allocator<char>, boost::asio::detail::transfer_exactly_t, SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> > >::read_request_and_content(std::shared_ptr<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> > >)::{lambda(boost::system::error_code const&, unsigned long)#1}::operator()(boost::system::error_code const&, unsigned long) const::{lambda(boost::system::error_code const&, unsigned long)#1}> >::do_complete(boost::asio::detail::task_io_service*, boost::asio::detail::task_io_service_operation*, boost::system::error_code const&, unsigned long)
---Type <return> to continue, or q <return> to quit---
    ()
#24 0x000000000044e060 in boost::asio::detail::task_io_service::run(boost::system::error_code&) ()
#25 0x000000000057e8b6 in std::thread::_Impl<std::_Bind_simple<SimpleWeb::ServerBase<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> > >::start()::{lambda()#1} ()> >::_M_run()
    ()
#26 0x00007ffff6520a40 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#27 0x00007ffff5d3d182 in start_thread (arg=0x7fffd3ff7700)
    at pthread_create.c:312
#28 0x00007ffff5a6a47d in clone ()
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Michael

Hast du ein paar Zeilen Code, wie du das Datenpaket baust? Wie sieht das JSON Objekt aus?

paresy

So:

 IPS_SendDataToParent($this->InstanceID, json_encode(Array(
                        "DataID" => "{4A550680-80C5-4465-971E-BBF83205A02B}",
                        "EventID" => 0,
                        "Buffer" => $Data))); 

Hier mehr:
https://github.com/Nall-chan/IPSElro/blob/master/ELROBase.php
Ab Zeile 193.
Michael

Für die nächste Version gibt es keinen Absturz sondern eine bessere Fehlermeldung :slight_smile:

Du hast eine wichtige Sache vergessen :smiley: Den Buffer musst du vorher über utf8_encode laufen lassen… Ansonsten wird kein korrekter JSON String produziert, sondern es steht als Wert null drin :slight_smile:


 IPS_SendDataToParent($this->InstanceID, json_encode(Array(
                        "DataID" => "{4A550680-80C5-4465-971E-BBF83205A02B}",
                        "EventID" => 0,
                        "Buffer" => utf8_encode($Data))));  

paresy

UPS… danke.
Überlege gerade wie das jetzt bei meinen Squeezebox-Modul ist (Dort geht es auch so, mal sehen was dort passiert wenn ich das ändere. Nicht dass ich dann Probleme mit dem Zeichensatz bekomme.)
Peinlich :smiley:
Michael

Ok, Paßt… damit komme ich klar.
Danke.
Hatte das utf8_encode nur auf das IPS_LogMessage bezogen :smiley:

Dafür was neues zum Thema PHP-Funktionen der Module.

IP-Symcon Community Forum

Michael