Replies: 11 comments
-
An interesting observation is that is I change this code to use MQTT from AMQP, then everything works. Is AMQP not supported for Direct Module Methods? |
Beta Was this translation helpful? Give feedback.
-
Hi @gri6507 , Direct Methods are supported using AMQP as well. Could you enable verbose logs (in your #if defined LOG_TRACE_ENABLED block) and paste them here please? Don't forget to obfuscate your IoT Hub fqdn and device id. |
Beta Was this translation helpful? Give feedback.
-
@ewertons Thank you for following up. I rebuilt my module with LOG_TRACE_ENABLED. Here is the module log at startup (hopefully I properly obfuscated things):
I then tested that Module Twin updates work. Here's the module log for that step
I then tried to send a Direct Method to the module, which failed the same way. There was nothing printed in the module log, edgeAgent log, nor the edgeHub log. |
Beta Was this translation helpful? Give feedback.
-
@ewertons - Just wanted to follow up to see if you had any more questions or perhaps a status update. |
Beta Was this translation helpful? Give feedback.
-
@ewertons - Following up again to see if you have an update on this issue |
Beta Was this translation helpful? Give feedback.
-
Hi @gri6507 , we deeply apologize, but we got reassigned to work on new development and some of the issues got delayed. So the logs show that you eventually connect.
If you look into the code, it logs the result of so_error, 111. So I would say the device is having trouble reaching the server in the first seconds. As for the main issue you are having, looks like it's being caused by this: Which is quite puzzling. |
Beta Was this translation helpful? Give feedback.
-
@ewertons Thank you for the follow-up. With regards to your comment
Is there anything that you need from my app to understand this? Or is this an internal MSFT investagation? |
Beta Was this translation helpful? Give feedback.
-
I can confirm this. With Amqp I can not execute Direct Method or even send messages. below the logs of the sample Module.
`
Waiting for incoming messages.
-> Header (AMQP 0.1.0.0)
<- Header (AMQP 0.1.0.0)
-> [OPEN]* {08986977-8814-44c5-a14f-74fdfb565fa3,ca-linux,4294967295,65535,240000}
<- [OPEN]* {DeviceGateway_ccdfd10852cd4ed6864dd9e336bc1a51,localhost,65536,8191,240000,NULL,NULL,NULL,NULL,NULL}
-> [BEGIN]* {NULL,0,4294967295,100,4294967295}
<- [BEGIN]* {0,1,5000,4294967295,262143,NULL,NULL,NULL}
-> [ATTACH]* {$cbs-sender,0,false,0,0,* {$cbs},* {$cbs},NULL,NULL,0,0}
-> [ATTACH]* {$cbs-receiver,1,true,0,0,* {$cbs},* {$cbs},NULL,NULL,NULL,0}
<- [ATTACH]* {$cbs-sender,0,true,0,0,* {$cbs,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL},* {$cbs,NULL,NULL,NULL,NULL,NULL,NULL},NULL,NULL,NULL,1048576,NULL,NULL,{}}
<- [FLOW]* {0,5000,1,4294967295,0,0,1000,0,NULL,false,NULL}
-> [TRANSFER]* {0,0,<01 00 00 00>,0,false,false}
<- [ATTACH]* {$cbs-receiver,1,false,0,0,* {$cbs,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL},* {$cbs,NULL,NULL,NULL,NULL,NULL,NULL},NULL,NULL,0,1048576,NULL,NULL,{}}
-> [FLOW]* {1,4294967295,1,99,1,0,10000}
<- [TRANSFER]* {1,0,<01 00 00 00>,0,NULL,false,NULL,NULL,NULL,NULL,false}
-> [DISPOSITION]* {true,0,0,true,* {}}
-> [ATTACH]* {link-snd-test-45deca09-524f-4e3c-be62-7c4cba507212,2,false,0,0,* {link-snd-test-45deca09-524f-4e3c-be62-7c4cba507212-source},* {amqps://ca-linux/devices/test/modules/SampleModule3/messages/events},NULL,NULL,0,18446744073709551615,NULL,NULL,{[com.microsoft:client-version:iothubclient/1.3.9 (native; Linux; armv7l)]}}
-> [ATTACH]* {link-snd-test-beceb161-e226-4d25-90fd-d7cde058212b,3,false,0,0,* {link-snd-test-beceb161-e226-4d25-90fd-d7cde058212b-source},* {amqps://ca-linux/devices/test/modules/SampleModule3/twin},NULL,NULL,0,18446744073709551615,NULL,NULL,{[com.microsoft:client-version:iothubclient/1.3.9 (native; Linux; armv7l)],[com.microsoft:channel-correlation-id:twin:67b4a309-9572-4796-a506-1eceb2078934],[com.microsoft:api-version:2019-10-01]}}
<- [ATTACH]* {link-snd-test-beceb161-e226-4d25-90fd-d7cde058212b,3,true,1,NULL,* {link-snd-test-beceb161-e226-4d25-90fd-d7cde058212b-source,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL},* {amqps://ca-linux/devices/test/modules/SampleModule3/twin,NULL,NULL,NULL,NULL,NULL,NULL},NULL,NULL,NULL,1048576,NULL,NULL,{[com.microsoft:client-version:iothubclient/1.3.9 (native; Linux; armv7l)],[com.microsoft:channel-correlation-id:twin:67b4a309-9572-4796-a506-1eceb2078934],[com.microsoft:api-version:2019-10-01]}}
<- [ATTACH]* {link-snd-test-45deca09-524f-4e3c-be62-7c4cba507212,2,true,NULL,NULL,* {link-snd-test-45deca09-524f-4e3c-be62-7c4cba507212-source,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL},* {amqps://ca-linux/devices/test/modules/SampleModule3/messages/events,NULL,NULL,NULL,NULL,NULL,NULL},NULL,NULL,NULL,1048576,NULL,NULL,{[com.microsoft:client-version:iothubclient/1.3.9 (native; Linux; armv7l)]}}
<- [FLOW]* {1,4999,2,4294967295,2,0,1000,0,NULL,false,NULL}
<- [FLOW]* {1,4999,2,4294967295,3,0,1000,0,NULL,false,NULL}
-> [ATTACH]* {link-rcv-test-4109a6e4-2732-4259-9196-2c0bd53dca10,4,true,0,0,* {amqps://ca-linux/devices/test/modules/SampleModule3/twin},* {link-rcv-test-4109a6e4-2732-4259-9196-2c0bd53dca10-target},NULL,NULL,NULL,18446744073709551615,NULL,NULL,{[com.microsoft:client-version:iothubclient/1.3.9 (native; Linux; armv7l)],[com.microsoft:channel-correlation-id:twin:67b4a309-9572-4796-a506-1eceb2078934],[com.microsoft:api-version:2019-10-01]}}
<- [ATTACH]* {link-rcv-test-4109a6e4-2732-4259-9196-2c0bd53dca10,4,false,1,0,* {amqps://ca-linux/devices/test/modules/SampleModule3/twin,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL},* {link-rcv-test-4109a6e4-2732-4259-9196-2c0bd53dca10-target,NULL,NULL,NULL,NULL,NULL,NULL},NULL,NULL,0,1048576,NULL,NULL,{[com.microsoft:client-version:iothubclient/1.3.9 (native; Linux; armv7l)],[com.microsoft:channel-correlation-id:twin:67b4a309-9572-4796-a506-1eceb2078934],[com.microsoft:api-version:2019-10-01]}}
-> [FLOW]* {2,4294967294,1,99,4,0,10000}
-> [ATTACH]* {methods_responses_link-test/SampleModule3,6,false,0,0,* {responses},* {amqps://ca-linux/devices/test/modules/SampleModule3/methods/devicebound},NULL,NULL,0,0,NULL,NULL,{[com.microsoft:channel-correlation-id:test/SampleModule3],[com.microsoft:api-version:2019-10-01]}}
-> [ATTACH]* {methods_requests_link-test/SampleModule3,5,true,0,0,* {amqps://ca-linux/devices/test/modules/SampleModule3/methods/devicebound},* {requests},NULL,NULL,NULL,0,NULL,NULL,{[com.microsoft:channel-correlation-id:test/SampleModule3],[com.microsoft:api-version:2019-10-01]}}
<- [ATTACH]* {methods_responses_link-test/SampleModule3,5,true,1,NULL,* {responses,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL},* {amqps://ca-linux/devices/test/modules/SampleModule3/methods/devicebound,NULL,NULL,NULL,NULL,NULL,NULL},NULL,NULL,NULL,1048576,NULL,NULL,{[com.microsoft:channel-correlation-id:test/SampleModule3],[com.microsoft:api-version:2019-10-01]}}
<- [FLOW]* {1,4999,2,4294967294,5,0,1000,0,NULL,false,NULL}
<- [ATTACH]* {methods_requests_link-test/SampleModule3,6,false,1,0,* {amqps://ca-linux/devices/test/modules/SampleModule3/methods/devicebound,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL},* {requests,NULL,NULL,NULL,NULL,NULL,NULL},NULL,NULL,0,1048576,NULL,NULL,{[com.microsoft:channel-correlation-id:test/SampleModule3],[com.microsoft:api-version:2019-10-01]}}
-> [FLOW]* {2,4294967294,1,99,5,0,10000}
-> [TRANSFER]* {2,1,<01 00 00 00>,2147563264,false,false}
<- [DISPOSITION]* {true,1,NULL,true,* {},NULL}
sent message status = 0
-> [TRANSFER]* {2,2,<02 00 00 00>,2147563264,false,false}
<- [DISPOSITION]* {true,2,NULL,true,* {},NULL}
sent message status = 0
-> [TRANSFER]* {2,3,<03 00 00 00>,2147563264,false,false}
<- [DISPOSITION]* {true,3,NULL,true,* {},NULL}
sent message status = 0
-> [TRANSFER]* {2,4,<04 00 00 00>,2147563264,false,false}
<- [DISPOSITION]* {true,4,NULL,true,* {},NULL}
sent message status = 0
-> [TRANSFER]* {2,5,<05 00 00 00>,2147563264,false,false}
<- [DISPOSITION]* {true,5,NULL,true,* {},NULL}
sent message status = 0
-> [TRANSFER]* {2,6,<06 00 00 00>,2147563264,false,false}
<- [DISPOSITION]* {true,6,NULL,true,* {},NULL}
sent message status = 0
-> [TRANSFER]* {2,7,<07 00 00 00>,2147563264,false,false}
<- [DISPOSITION]* {true,7,NULL,true,* {},NULL}
sent message status = 0
-> [TRANSFER]* {2,8,<08 00 00 00>,2147563264,false,false}
<- [DISPOSITION]* {true,8,NULL,true,* {},NULL}
sent message status = 0
<- [TRANSFER]* {6,1,,0,true,false,NULL,NULL,NULL,NULL,false}
Error: Time:Fri Jul 31 11:40:26 2020 File:/build/azure-uamqp-c-2jljYf/azure-uamqp-c-0.2.0.0/src/amqpvalue.c Func:amqpvalue_get_uuid Line:951 Value is not of type UUID
Error: Time:Fri Jul 31 11:40:26 2020 File:/build/azure-iot-sdk-c-v_9EOv/azure-iot-sdk-c-0.2.0.0/iothub_client/src/iothubtransportamqp_methods.c Func:on_message_received Line:332 Cannot get uuid value for correlation-id
-> [DISPOSITION]* {true,1,1,true,* {* {amqp:decode-error,Cannot get uuid value for correlation-id}}}
`
|
Beta Was this translation helpful? Give feedback.
-
First apologies to everyone that I'm jumping on this so late. ;tl-dr is I'm going to fix up documentation to warn better on this and mark as an enhancement to add some extra runtime warnings. AMQP is indeed not officially supported when running modules inside of IoT Edge using the IoT C SDK. And to be clear this is a C SDK limitation. In C# for instance there's something like In the perfect world we would make it so So there are really two issues here:
Also note we do have a very basic sample of this checked in here showing authoring of a module to receive methods. This will get some of doc cleanup focus around allowed protocol of course. |
Beta Was this translation helpful? Give feedback.
-
@jspaith - Thank you for the update. It is quite disappointing to know that the "standard" API across different SDKs does not behave the same way. What I think is still missing in your explanation is the underlying cause for why the C SDK even has the limitation in the first place. Are there any plans to address that? |
Beta Was this translation helpful? Give feedback.
-
@gri6507 - I'm not happy this got out either. The C has this limitation because of a coding bug, where the module code JSON was copied from the service JSON which itself was incorrect. It was not by design that the behavior would be different cross-SDK. I'm also going to have a look at our E2E tests because those should've caught this too. |
Beta Was this translation helpful? Give feedback.
-
I am having trouble implementing a Direct Module Method handler in my azure-iot-sdk-c based IoT Edge Module. I could not find a documentation page with an example implementation, so I assembled my implementation from various SDK documentation pages and unit test "examples".
To test this, I have a dedicated Linux based PC (Ubuntu 18.04) running iotedge 1.0.8-2. I can see that my module is starting and printing its version and firing the connection status callback message. I even even see that the ModuleTwin callback is firing and printing the payload when I manually edit the module identity twin for my device in the portal.
However, when I try to manually invoke a Direct Method on my module within my device in the portal, I see nothing printed and I get the following error in the portal:
The relevant code is below. I looked on StackOverflow but examples there are not C SDK based. Where am I going wrong with Direct Module Methods? Thank you!
Beta Was this translation helpful? Give feedback.
All reactions