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

IothubClient ReceiveAsync() timed out #133

Open
hauszerm opened this issue Feb 19, 2019 · 1 comment
Open

IothubClient ReceiveAsync() timed out #133

hauszerm opened this issue Feb 19, 2019 · 1 comment

Comments

@hauszerm
Copy link

hauszerm commented Feb 19, 2019

We have upgraded the protocol gateway
After the Upgrade we have an issue with the IothubClient.ReceiveAsync() method.

Code Snippet

   async void Receive() 
    {
       Message message = null;
        IByteBuffer messagePayload = null;
        try
        {
            while (true)
            {
                message = await this.deviceClient.ReceiveAsync(TimeSpan.MaxValue);
                if (message == null)
                {
                    this.messagingChannel.Close(null);
                    return;
                }
               .......

We are now receiving NULL messages after 40s - 60s.
Before the Update, the ReceiveAsync() delivered a NULL message only in case of an iothub disconnect, not every 40s - 60s.
According to the unchanges code in this code snippet, the connection to the iothub will be closed and has to be established once more, a behaviour, which is new since the upgrade the protocol gateway SDK.
Do you have any explanation for this behaviour?

best regards Michael

@anhashia
Copy link

anhashia commented Apr 15, 2019

@hauszerm : Unable to reproduce the issue with latest version of C# device SDK 1.20.0 which was recently released.

Used following code snippet in a standalone application

 while (true)
  {
              
            using (DeviceClient mydeviceClient = DeviceClient.CreateFromConnectionString(DeviceConnectionString, deviceId, TransportType.Amqp_Tcp_Only))
            {
                receivedMessage = await mydeviceClient.ReceiveAsync(TimeSpan.MaxValue).ConfigureAwait(false);


   if (receivedMessage != null)
                    {
                        messageData = Encoding.ASCII.GetString(receivedMessage.GetBytes());
                        Console.WriteLine("\t{0}> Received message: {1}", DateTime.Now.ToLocalTime(), messageData);

I don't see any NULL messages after 40s - 60 seconds.
Are you able to reproduce the issue using a standalone application ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants