Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sass challenge timeout #39432

Closed
ojeytonwilliams opened this issue Aug 19, 2020 · 5 comments · Fixed by #43744 or #44714
Closed

Sass challenge timeout #39432

ojeytonwilliams opened this issue Aug 19, 2020 · 5 comments · Fixed by #43744 or #44714
Labels
help wanted Open for all. You do not need permission to work on these. platform: learn UI side of the client application that needs familiarity with React, Gatsby etc. type: bug Issues that need priority attention. Platform, Curriculum tests (if broken completely), etc.

Comments

@ojeytonwilliams
Copy link
Contributor

Describe the bug
Sass pages with invalid syntax occasionally timeout

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://www.freecodecamp.org/learn/front-end-libraries/sass/store-data-with-sass-variables
  2. Paste in
<style type='text/scss'>
$text-color: red;

  .header{
    text-align: center;
  }
  .blog-post, h2 {
    color: $text-color;

</style>
  1. See timeout in the console (sometimes)

Expected behavior

The following should appear in the console:

Error: Invalid CSS after "...r: $text-color;": expected "}", was ""
        on line 8:24 of /stdin
>>     color: $text-color;

Since this is intermittent, here's a gif to demonstrate:

SassTimeout

Additional Context

When the error appears it does so very quickly, so it is unlikely that this is due to a genuine timeout.

@ojeytonwilliams ojeytonwilliams added type: bug Issues that need priority attention. Platform, Curriculum tests (if broken completely), etc. platform: learn UI side of the client application that needs familiarity with React, Gatsby etc. labels Aug 19, 2020
@ShaunSHamilton
Copy link
Member

Hey Oliver,

When I clicked on the link, I reset the code, and completed the challenge as it should be completed. I came across a timeout error, and was unable to run the tests.

However, after resetting the code, refreshing the page, and pasting in the code you provided (missing }), the error you mention appeared, but does not disappear.

So, I suspect it has to do with the page first load, because I can get the timeout error only if I:

  1. reset the code
  2. Duplicate the tab
  3. Input the incorrect code (missing })

image

@morgan-sam
Copy link

morgan-sam commented Aug 24, 2020

I tried @SKY020's method but that didn't produce the bug.

I am able to reliably reproduce the bug on Chromium & Firefox with the following steps:

  1. Open the page (new tab & refresh can both produce bug).
  2. Repeatedly delete & re-add the } character from line 9, fast enough that the new state does not display in the console.
  3. End step 2 on deleting the }. If done correctly the Your test output will go here message will display instead of an error, even though the console input is incorrect.
  4. Wait approximately 3-5 seconds for the timeout message to appear.

Note: it can also be reproduced where by in step 2 you end on re-adding the } but it's harder to tell if the bug has happened.

It must have something to do with the console state change and the output error check conflicting.

@prolland006
Copy link
Contributor

prolland006 commented Nov 15, 2020

I worked on this issue on my old computer that is very slow and on my main PC (with a dual boot). On my old computer I have the same result as @ojeytonwilliams, regurlaly timeouts. On the new one to have this issue I have to paste 3 times the piece of code to reproduce it. But everytimes, this is a real timeout (5ms, I put 'new Date()' on the code).

We can upgrade the source code one "execute-challenge-saga.js" with this kind of stuff to have a best message, but still the problem :

let errMsg = 'error';
if (err === 'timeout') {
   // eslint-disable-next-line no-ex-assign
   errMsg = `The code you have written is taking longer than the ${previewTimeout}ms our challenges allow. You may have created an infinite loop or need to write a more efficient algorithm`;
} else if (Array.isArray(err) && err.length>0 && err[0] === 'timeout') { // timeout: 5ms
   errMsg = `Server response timeout`;
} else {
   errMsg = err;
}
console.log(errMsg);
yield put(updateConsole(escape(errMsg)));

so the result will be "Server response timeout"

@ojeytonwilliams ojeytonwilliams added the help wanted Open for all. You do not need permission to work on these. label Aug 3, 2021
@ojeytonwilliams
Copy link
Contributor Author

While this is old, it's still reproducible, unfortunately. A PR to improve the warning would be welcome.

@jacob-oreilly
Copy link
Contributor

I’m currently taking a look into a possible solution on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Open for all. You do not need permission to work on these. platform: learn UI side of the client application that needs familiarity with React, Gatsby etc. type: bug Issues that need priority attention. Platform, Curriculum tests (if broken completely), etc.
Projects
None yet
5 participants