Error 6037
If you have received Error 6037, you probably have a device that is not implemented properly. In particular a device should not do ANY long running operation in its Start() or Stop() methods. The reason for this is that Connexion reserves 20 Threads for performing Stop/Start operations on Channels. If those 20 threads are tied up servicing long running Start/Stop operations, than other Channels cannot be started or stopped. The rationale for the 20 thread limit comes from performance testing the starting of many channels. If the .NET framework is allowed to create threads on its own, the machine spends most of its time spinning up new threads. Each thread requires 1MB of stack, so the OS must allocate memory for each thread.
Here are some important considerations when developing your device.
Don’t do ANY time consuming work in
Start()orStop().Use
async/awaitwhere possible. This reduces the number of threads required by Connexion and results in better performance, and lower memory usage. This is especially important if the Connexion is running more than 100 channels.Prefer
ProcessMessageAsyncoverProcessMessage. Same as (2), but specific for processing messages. Also,ProcessMessagewill be obsoleted in the next version of Connexion.Use
OnErrorto handle retrying. This usesasync/awaitunder the covers so there are no threads tied up sleeping.