Queue_and_Threshold_Sizes.axi
I can't find any original thread for this so here goes.
My code suddenly stopped working yesterday, with none of the virtual devices visible in "show device". This is a symptom of technote 809 which recommends increasing the Device Manager Queue Size to 1500. The default is 500 and that's what my copy of Queue_and_Threshold_Sizes.axi was setting it to. Changing the queue size solved the problem so I've updated the code (also increasing some settings to their defaults) and thought I would share it here. Sorry about the formatting:
My code suddenly stopped working yesterday, with none of the virtual devices visible in "show device". This is a symptom of technote 809 which recommends increasing the Device Manager Queue Size to 1500. The default is 500 and that's what my copy of Queue_and_Threshold_Sizes.axi was setting it to. Changing the queue size solved the problem so I've updated the code (also increasing some settings to their defaults) and thought I would share it here. Sorry about the formatting:
(*** iInternalCheck.axi ***)
(* This must be in the mainline because it has persistent variables *)
#if_not_defined DefineInternalCheck
#define DefineInternalCheck
(******************************************************************************)
define_constant
(******************************************************************************)
integer nRebootMax = 5
(******************************************************************************)
define_variable
(******************************************************************************)
volatile integer bNeedReboot
persistent integer nRebootCount
persistent integer nCheckCount
(******************************************************************************)
define_function CheckQueueSize (
long lArgIndex ,
long lArgValue ,
char sArgComment[] )
(******************************************************************************)
{
stack_var long lValue
lValue = internal_queue_size_get(lArgIndex)
if (lArgValue > lValue)
{
DebugNumber("'Adjust [',sArgComment,'] Queue Size from[',itoa(lValue),']to['",lArgValue)
internal_queue_size_set(lArgIndex,lArgValue)
bNeedReboot = True
}
} (* CheckQueueSize *)
(******************************************************************************)
define_function CheckThresholdSize (
long lArgIndex ,
long lArgValue ,
char sArgComment[] )
(******************************************************************************)
{
stack_var long lValue
lValue = internal_threshold_get(lArgIndex)
if (lArgValue > lValue)
{
DebugNumber("' Adjust [',sArgComment,'] Threshold from[',itoa(lValue),']to'",lArgValue)
internal_threshold_set(lArgIndex,lArgValue)
bNeedReboot = True
}
} (* CheckThresholdSize *)
(******************************************************************************)
define_function CheckInternals ()
(******************************************************************************)
{
(* Only ever do this 5 times on a new controller - nCheckCount is persistent *)
if (nCheckCount >= 5) return;
Debug('Check internals')
bNeedReboot = False
CheckThresholdSize(internal_threshold_index_interpreter ,2000 ,'Interpreter' )
CheckThresholdSize(internal_threshold_index_lontalk ,50 ,'Lontalk' )
CheckThresholdSize(internal_threshold_index_ip ,600 ,'IP' )
CheckQueueSize (internal_queue_size_index_interpreter ,3000 ,'Interpreter' )
CheckQueueSize (internal_queue_size_index_notification_mgr ,3000 ,'Notification Manager' )
CheckQueueSize (internal_queue_size_index_connection_mgr ,3000 ,'Connection Manager' )
CheckQueueSize (internal_queue_size_index_route_mgr ,400 ,'Route Manager' )
CheckQueueSize (internal_queue_size_index_device_mgr ,1500 ,'Device Manager' )
CheckQueueSize (internal_queue_size_index_diagnostic_mgr ,500 ,'Diagnostic Manager' )
CheckQueueSize (internal_queue_size_index_tcp_tx ,600 ,'TCP Transmit Threads' )
CheckQueueSize (internal_queue_size_index_ipconnection_mgr ,800 ,'IP Connection Manager' )
CheckQueueSize (internal_queue_size_index_message_dispatcher ,1000 ,'Message Dispatcher' )
CheckQueueSize (internal_queue_size_index_axlink_tx ,3000 ,'Axlink Transmit' )
CheckQueueSize (internal_queue_size_index_phastlink_tx ,3000 ,'PhastLink Transmit' )
CheckQueueSize (internal_queue_size_index_icsplontalk_tx ,500 ,'ICSNet Transmit' )
CheckQueueSize (internal_queue_size_index_icsp232_tx ,500 ,'ICSP 232 Transmit' )
CheckQueueSize (internal_queue_size_index_icspip_tx ,500 ,'UDP 232 Transmit' )
CheckQueueSize (internal_queue_size_index_ni_device ,500 ,'NI Device Manager' )
(* Check if need to reboot. Must reboot if we have changed internals *)
if ( (bNeedReboot )
and (nRebootCount < nRebootMax))
{
Debug('### Rebooting to set queue and theshold sizes ###')
nRebootCount++
RebootController()
}
} (* CheckInternals *)
(******************************************************************************)
define_start
(******************************************************************************)
wait 200 CheckInternals()
#end_if (* iInternalCheck.axi *)
(*** End of iInternalCheck.axi ***)
0
Comments
DEFINE_CONSTANT CHAR MIN_DUET_MEM = 8 // define minimum size DEFINE_START IF(DUET_MEM_SIZE_GET() < MIN_DUET_MEM) // if it's less than our minimum { DUET_MEM_SIZE_SET(MIN_DUET_MEM) // set it to minimum WAIT 30 { REBOOT(0) } // and reboot system }