lagrange: Lagrange crashes when it gets redirect response immediately after entering input

Hey! Lagrange keeps crashing from time to time after I do one very specific scenario. It happens not immediately but like after 5th or so attempt (I know, very specific… sorry). I discovered this issue while testing my framework and I wouldn’t be suprised if I am doing something wrong but I think crash is not expected anyway. I will paste server code snippet that maybe will help to understand scenario.

  app.OnRequest("/input", (request, response) => {
      if (request.Parameters == null)
      {
          response.SetInputHint("Please enter something: ");
          response.Status = StatusCode.Input;
      }
      else
      {
          // redirect with parameters to /show route
          response.SetRedirectURL(request.BaseURL + "/show?" + request.Parameters);
          response.Status = StatusCode.RedirectTemp;
      }
  });

  app.OnRequest("/show", (request, response) => {
      if (request.Parameters == null)
      {
          // redirect back to /input
          response.SetRedirectURL(request.BaseURL + "/input");
          response.Status = StatusCode.RedirectTemp;
      }
      else
      {
          // show what you entered
          response.RenderPlainTextLine("# " + request.Parameters);
      }
  });

Steps to reproduce:

  1. access route which responds with status code “10”, in this case “/input”
  2. enter anything
  3. server gets request with “/input?something” and immediately redirects to “/show?something” (I’ve tried relative and absolute URL - reproducible with both)
  4. repeat until Lagrange crashes - usually 4-8 attempts.

I’ve tried other browsers and I couldn’t reproduce the issue.

Please let me know if you need any additional info.

P.S. I love your browser!

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 26 (14 by maintainers)

Commits related to this issue

Most upvoted comments

I’ve pushed some multithreading fixes to the dev branch, they could be of help here.

The fix for #181 is included in v1.2.

Alright, I will take a look

I’ll try to figure out a way to reproduce this. I have seen a couple of crashes recently related to requests that finish very quickly, so there could be a race condition somewhere.