-
Notifications
You must be signed in to change notification settings - Fork 736
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
Messages not sending to IoTHub when sending data continuously #383
Comments
Could you try upgrading your SDK before we investigate deeper? In particular...
We've fixed a bunch of reconnection issues in 1.1.30 in particular so this issue may just resolve. |
@jspaith I will upgrade the SDK and update the result. |
@jspaith I have tested with latest release and still facing the same issue. |
@mrhprasanna - I've been assuming this is the issue being discussed offline with Ewerton but if this is a separate issue please set me straight. I know there's still loose ends to tie up on the reconnect over slow network issue so I'm not trying to close this, but I want to make sure we're not sweeping a separate issue under the rug. |
I'm closing out since it's been quiet a while and I think some off other discussions around this are a bit different than initial thread. By all means re-open or create new issues if there's further concerns. |
@mrhprasanna thank you for your contribution to our open-sourced project! Please help us improve by filling out this 2-minute customer satisfaction survey. |
OS and version used: <Ubuntu 14.04>
SDK version used: <1.1.29>
Description of the issue:
I have been using the SDK version 1.1.29 and identified that messages are not sending to IoTHub when sending data continuously though network connection is available.
Code sample exhibiting the issue:
//============================================================================
// Name : AzureSample.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C, Ansi-style
//============================================================================
#include <certs.h>
#include <stdio.h>
#include <stdlib.h>
#include
#include "azure_c_shared_utility/platform.h"
#include "azure_c_shared_utility/threadapi.h"
#include "azure_c_shared_utility/crt_abstractions.h"
#include "azureiot/iothub_client.h"
#include "azureiot/iothub_client_options.h"
#include "azureiot/iothub_message.h"
#include "azureiot/iothubtransportamqp_websockets.h"
#include "azureiot/iothubtransporthttp.h"
#include <unistd.h>
using namespace std;
static const char* connectionString="";
static int callbackCounter;
void init();
void destroy();
int confirmation = 0;
typedef struct EVENT_INSTANCE_TAG
{
IOTHUB_MESSAGE_HANDLE messageHandle;
int messageTrackingId; // For tracking the messages within the user callback.
} EVENT_INSTANCE;
static IOTHUBMESSAGE_DISPOSITION_RESULT ReceiveMessageCallback(IOTHUB_MESSAGE_HANDLE message, void* userContextCallback)
{
int* counter = (int*)userContextCallback;
const unsigned char* buffer = NULL;
size_t size = 0;
const char* messageId;
const char* correlationId;
}
static void SendConfirmationCallback(IOTHUB_CLIENT_CONFIRMATION_RESULT result, void* userContextCallback)
{
EVENT_INSTANCE* eventInstance = (EVENT_INSTANCE*)userContextCallback;
(void)printf("Confirmation[%d] received for message tracking id with result = %s\r\n",callbackCounter,ENUM_TO_STRING(IOTHUB_CLIENT_CONFIRMATION_RESULT, result));
/* Some device specific action code goes here... */
callbackCounter++;
if(result==IOTHUB_CLIENT_CONFIRMATION_OK)
{
confirmation = 1;
IoTHubMessage_Destroy(eventInstance->messageHandle);
eventInstance->messageHandle = NULL;
}
else
{
confirmation = -1;
}
}
static char msgText[1024];
static char propText[1024];
IOTHUB_CLIENT_HANDLE iotHubClientHandle;
size_t retryTimeSeconds=0;
static void connectionStatusCallback(IOTHUB_CLIENT_CONNECTION_STATUS callback,
IOTHUB_CLIENT_CONNECTION_STATUS_REASON reason, void *userContext)
{
}
void init()
{
int receiveContext = 0;
if (platform_init() != 0)
{
(void)printf("ERROR: failed initializing the platform.\r\n");
}
//AMQP_Protocol_over_WebSocketsTls HTTP_Protocol
else if ((iotHubClientHandle = IoTHubClient_CreateFromConnectionString(connectionString,AMQP_Protocol_over_WebSocketsTls)) == NULL)
{
(void)printf("ERROR: iotHubClientHandle is NULL!\r\n");
platform_deinit();
}
else
{
/* unsigned int timeout = 241000;
// Because it can poll "after 9 seconds" polls will happen effectively // at ~10 seconds.
// Note that for scalabilty, the default value of minimumPollingTime
// is 25 minutes. For more information, see:
// https://azure.microsoft.com/documentation/articles/iot-hub-devguide/#messaging
unsigned int minimumPollingTime = 9;
if (IoTHubClient_SetOption(iotHubClientHandle, "timeout", &timeout) != IOTHUB_CLIENT_OK)
{
printf("failure to set option "timeout"\r\n");
}
if (IoTHubClient_SetOption(iotHubClientHandle, "MinimumPollingTime", &minimumPollingTime) != IOTHUB_CLIENT_OK)
{
printf("failure to set option "MinimumPollingTime"\r\n");*/
// For mbed add the certificate information
if (IoTHubClient_SetOption(iotHubClientHandle, "TrustedCerts", certificates) != IOTHUB_CLIENT_OK)
{
printf("failure to set option "TrustedCerts"\r\n");
}
}
void destroy()
{
IoTHubClient_Destroy(iotHubClientHandle);
platform_deinit();
}
void iothub_client_sample_amqp_websockets_run(EVENT_INSTANCE* messages)
{
int main(void)
{
init();
EVENT_INSTANCE message[1000];
int i=0;
while(true)
{
std::cout<<"Slot ID:"<<i<<std::endl;
iothub_client_sample_amqp_websockets_run(&message[i]);
i=i+1;
sleep(1);
if(i == 1000)
{
i= 0;
}
}
return EXIT_SUCCESS;
}
Console log of the issue:
Info: Preparing transport for re-connection
Error: Time:Mon Feb 19 17:07:02 2018 File:/build/azure-iot-sdk-c-o2dV7s/azure-iot-sdk-c-0.1.0/iothub_client/src/iothubtransportamqp_methods.c Func:iothubtransportamqp_methods_unsubscribe Line:817 unsubscribe called while not subscribed
Error: Time:Mon Feb 19 17:07:02 2018 File:/home/administrator/azure-iot-sdk-c/uamqp/src/saslclientio.c Func:saslclientio_send_async Line:1173 send called while not open
Error: Time:Mon Feb 19 17:07:02 2018 File:/home/administrator/azure-iot-sdk-c/uamqp/src/connection.c Func:on_bytes_encoded Line:253 Cannot send encoded bytes
Error: Time:Mon Feb 19 17:07:02 2018 File:/home/administrator/azure-iot-sdk-c/uamqp/src/saslclientio.c Func:saslclientio_close_async Line:1122 saslclientio_close called while not open
Error: Time:Mon Feb 19 17:07:02 2018 File:/home/administrator/azure-iot-sdk-c/uamqp/src/connection.c Func:on_bytes_encoded Line:257 xio_close failed
Error: Time:Mon Feb 19 17:07:02 2018 File:/home/administrator/azure-iot-sdk-c/uamqp/src/saslclientio.c Func:saslclientio_close_async Line:1122 saslclientio_close called while not open
Error: Time:Mon Feb 19 17:07:02 2018 File:/home/administrator/azure-iot-sdk-c/uamqp/src/connection.c Func:connection_close Line:1358 xio_close failed
Reason [4]connection is not available
Slot ID:246
IoTHubClient_SendEventAsync accepted data for transmission to IoT Hub.
The text was updated successfully, but these errors were encountered: