opserver / Opserver

Stack Exchange's Monitoring System
https://opserver.github.io/Opserver/
MIT License
4.51k stars 827 forks source link

Connecting to an Alpha / Beta elasticsearch cluster throws Format Exception #220

Closed nlowe closed 7 years ago

nlowe commented 8 years ago

Prerelease elasticsearch versions append -alphaN or -betaN (for example, 5.0.0-beta1) where N is the nth release candidate or beta for a specific series. It appears that System.Version cannot parse this and as such the Elasticsearch page cannot be loaded.

Proposed Solutions

  1. Mask off any extra text using a regular expression and continue to parse with System.Version
  2. Parse it with a semver library and compare that way

    Stack Trace

[FormatException: Input string was not in a correct format.]
   System.VersionResult.SetFailure(ParseFailureKind failure, String argument) +14194244
   System.Version.TryParseComponent(String component, String componentName, VersionResult& result, Int32& parsedComponent) +126
   System.Version.TryParseVersion(String version, VersionResult& result) +244
   System.Version.Parse(String input) +88
   StackExchange.Opserver.Data.Elastic.NodeInfo.get_Version() +97
   ASP.<>c.<CommonVersionHeader>b__0_1(NodeInfo n) in C:\inetpub\wwwroot\opserver\Views\Elastic\AllClusters.cshtml:15
   System.Linq.WhereSelectListIterator`2.MoveNext() +141
   System.Linq.Enumerable.Min(IEnumerable`1 source) +145
   ASP.<>c__DisplayClass0_0.<CommonVersionHeader>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\opserver\Views\Elastic\AllClusters.cshtml:15
   System.Web.WebPages.WebPageBase.Write(HelperResult result) +108
   ASP._Page_Views_Elastic_AllClusters_cshtml.Execute() in C:\inetpub\wwwroot\opserver\Views\Elastic\AllClusters.cshtml:79
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +253
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +148
   System.Web.WebPages.StartPage.ExecutePageHierarchy() +89
   System.Web.WebPages.StartPage.ExecutePageHierarchy() +89
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +107
   StackExchange.Profiling.Mvc.WrappedView.Render(ViewContext viewContext, TextWriter writer) +193
   System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +375
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +90
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +833
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +81
   System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +186
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38
   System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +29
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +65
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +53
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +36
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38
   System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +44
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +65
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +399
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +157
NickCraver commented 7 years ago

@nlowe Can you give latest a try please?

nlowe commented 7 years ago

@NickCraver We already upgraded our cluster to 5.0.0 GA. I'll see if I can spin up a beta node sometime today to test the fix.

nlowe commented 7 years ago

Seems to have resolved the problem 👍 . Thanks!