Opened 9 years ago

Closed 9 years ago

#122 closed defect (fixed)

GetLog function of WebAPI results in ArgumentException

Reported by: theit8514 Owned by: Christian Illy
Priority: minor Component: Server fixes
Keywords: GetLog ArgumentException Cc:

Description

I'm unable to view the logs on the web frontend due to an exception in GetLog. The issue stems from LogBuffer.GetRange. After review of the code on svn, the GetLog handler is hard coded to 50 for _count but the MAX_ENTRIES on the LogBuffer is set to 30. Since LogBuffer.GetRange does not check upper bounds, GetLog can never retrieve the logs.

Options:

  1. Update GetLog.HandleRequest to utilize LogBuffer.MAX_ENTRIES (make public)
  2. Update LogBuffer.GetRange to check if we can pull _count items based on _start and listOffset, and reset _count to a sane value
2015-12-27T03:20:22 97520.419 ERR Error in ApiHandler.HandleRequest(): Handler getlog threw an exception:
2015-12-27T03:20:22 97520.420 EXC index and count exceed length of list
ArgumentException: index and count exceed length of list
  at System.Collections.Generic.List`1[AllocsFixes.NetConnections.Servers.Web.LogBuffer+LogEntry].CheckRange (Int32 idx, Int32 count) [0x00000] in <filename unknown>:0
  at System.Collections.Generic.List`1[AllocsFixes.NetConnections.Servers.Web.LogBuffer+LogEntry].GetRange (Int32 index, Int32 count) [0x00000] in <filename unknown>:0
  at AllocsFixes.NetConnections.Servers.Web.LogBuffer.GetRange (System.Int32& _start, Int32 _count, System.Int32& _end) [0x00000] in <filename unknown>:0
  at AllocsFixes.NetConnections.Servers.Web.API.GetLog.HandleRequest (System.Net.HttpListenerRequest req, System.Net.HttpListenerResponse resp, AllocsFixes.NetConnections.Servers.Web.WebConnection user, Int32 permissionLevel)[0x00000] in <filename unknown>:0
  at AllocsFixes.NetConnections.Servers.Web.Handlers.ApiHandler.HandleRequest (System.Net.HttpListenerRequest req, System.Net.HttpListenerResponse resp, AllocsFixes.NetConnections.Servers.Web.WebConnection user, Int32 permissionLevel) [0x00000] in <filename unknown>:0

Change History (1)

comment:1 by Christian Illy, 9 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.