adobkin / libcapn

A simple C Library for interact with the Apple Push Notification Service (APNs)
MIT License
100 stars 37 forks source link

apn_send() cause segmentation fault with Libcapn APNS Library #39

Closed frazier120 closed 7 years ago

frazier120 commented 7 years ago

I use Libcapn Library (http://libcapn.org) to send message to iphone on C.

I can use the example to send message to iphone successfully. Now I write the example as a function and build with my server code. when the process call function to send message, it get segmentation fault.

Error message: ======> [apn][inf]: SSL connection has been established ======> [apn][inf]: Creating binary message from payload... ERROR: signal 11 was trigerred: Fault address: 0x8 Fault reason: address not mapped to object Stack trace folows (partial): ./main.bin(segmentation_fault_handler+0xd4)[0x805e213] [0xb77a5ce8] /lib/i386-linux-gnu/libjson-c.so.2(json_object_iter_next+0x6)[0xb77849d6] /usr/lib/capn/libcapn.so.2(+0xab71)[0xb7627b71] /usr/lib/capn/libcapn.so.2(json_dump_callback+0x60)[0xb7627edc] /usr/lib/capn/libcapn.so.2(json_dumps+0x4b)[0xb7627da3] /usr/lib/capn/libcapn.so.2(apn_create_json_document_from_payload+0x2fb)[0xb7624bbb] /usr/lib/capn/libcapn.so.2(apn_create_binary_message+0x2b)[0xb762526b] /usr/lib/capn/libcapn.so.2(apn_send+0x8e)[0xb7622fce] ./main.bin[0x808402c]

I have no idea why the error happened, please help me.