Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection intermittant #1

Closed
STEPHER2 opened this issue Nov 17, 2016 · 4 comments
Closed

Connection intermittant #1

STEPHER2 opened this issue Nov 17, 2016 · 4 comments
Labels

Comments

@STEPHER2
Copy link

STEPHER2 commented Nov 17, 2016

Having an issue in that initial connection to the Iot Hub is intermittent, it seems to sometimes hang whenever it reaches:

/*Codes_SRS_IOTHUBCLIENT_LL_02_021: [Otherwise, IoTHubClient_LL_DoWork shall invoke the underlaying layer's _DoWork function.]*/ handleData->IoTHubTransport_DoWork(handleData->transportHandle, iotHubClientHandle);

inside iothub_client_II.c @ line 766

Im using the mBed platform and cant follow the code because i cant breakpoint where inside the function pointer it specifically holds up?

@markrad
Copy link
Member

markrad commented Dec 5, 2016

Hi @STEPHER2,

Am I correct is suggesting that you are using the low level code, that is the functions with LL in their name?

I did encounter this myself once but I found that converting the code to use the high level functions addressed the problem. Since this is what my customer wanted anyway, I did not pursue this any further and assumed it was just a quirk on my system.

I will attempt to reproduce this again and debug it. In the meantime you might try the high level API and see if it resolves the issue for you too.

Mark Radbourne MSFT

@STEPHER2
Copy link
Author

STEPHER2 commented Dec 8, 2016

Hi @markrad

Thanks for the reply, i am seeing other intermittent connection issues where it tries to connect and cant (assume the server is holding a connection open and the device is trying to reconnect to it again?) which then produces one of the following reasons:

Failed to initialize the platform
Error io_open failed
Failure sending control packet

If any of these errors occur and i try sending a message to the hub i get:

sys_init error

and the device just sits spinning its wheels doing nothing except from flashing the on board red LED. Tried to find where this is happening byt it is impossible.

Have you seen any of these errors?

Many thanks

Ryan

@markrad
Copy link
Member

markrad commented Dec 8, 2016

Hi @STEPHER2,

Yes. As it happens I was debugging this just yesterday. Though I can't be certain that you are hitting the same issue I was able to cause the sys_init error by calling the EthernetInterface::init function twice. This causes a second call to tcpip_init. The sad truth is that the quality of the code in EthernetInterface is very poor. It doesn't check return codes and it fails to expose the network connected/disconnected events. Furthermore I found it very difficult to implement network recovery in the code and resorted to forcing a hard reset. You can view my code here: https://developer.mbed.org/users/markrad/code/FXOS8700CQ_To_Azure_IoT/.
Please change the connection string if you choose to test it.

Mark Radbourne MSFT

@markrad
Copy link
Member

markrad commented Dec 27, 2016

Hi @STEPHER2,

Since I didn't hear back from you I am closing this issue. Hopefully the code I provided was some assistance to you in recovering the network connection. You are welcome to reopen this issue if the problem persists.

Mark Radbourne MSFT

@markrad markrad closed this as completed Dec 27, 2016
erich-wang pushed a commit that referenced this issue Oct 20, 2017
Enabled the use AMQP for Azure IoT Client PCL library.
ewertons added a commit that referenced this issue Jun 16, 2023
This change fixes a memory corruption caused by message queue when the
following scenario occurs:
MESSAGE1 is enqueued (address #1)
MESSAGE1 is put in progress by mq
MESSAGE1 is destroyed by the app
MESSAGE2 is enqueued (re-using address #1, which was made available
by the previous step)
MESSAGE2 is put in progress by the mq
MESSAGE2 processing is marked as completed by the app
> Here the message queue searches the list of in-progress messages by
the message address in memory. Since MESSAGE2 now has the same address
of MESSAGE1 (which was freed), message_queue picks the entry for
MESSAGE1 for removing from the in-progress list, leaving MESSAGE2
behind.
ewertons added a commit that referenced this issue Jun 19, 2023
This change fixes a memory corruption caused by message queue when the
following scenario occurs:
MESSAGE1 is enqueued (address #1)
MESSAGE1 is put in progress by mq
MESSAGE1 is destroyed by the app
MESSAGE2 is enqueued (re-using address #1, which was made available
by the previous step)
MESSAGE2 is put in progress by the mq
MESSAGE2 processing is marked as completed by the app
> Here the message queue searches the list of in-progress messages by
the message address in memory. Since MESSAGE2 now has the same address
of MESSAGE1 (which was freed), message_queue picks the entry for
MESSAGE1 for removing from the in-progress list, leaving MESSAGE2
behind.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants