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

[bug]: potentially race condition #553

Open
ShaunSHamilton opened this issue Apr 3, 2024 · 0 comments
Open

[bug]: potentially race condition #553

ShaunSHamilton opened this issue Apr 3, 2024 · 0 comments
Labels
patch This issue/PR results in a patch release type: bug Something isn't working

Comments

@ShaunSHamilton
Copy link
Member

Sometimes, specifically during development, an error is thrown by the config/state.json reader indicating the content is not valid JSON:

🟢 DEBUG:  2024-04-03 15:14:00 Watcher: change - /back-end-development-and-apis/curriculum/locales/english/build-a-timestamp-microservice.md
🔴 ERROR:  2024-04-03 15:14:34 SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at getState (file:///back-end-development-and-apis/node_modules/@freecodecamp/freecodecamp-os/.freeCodeCamp/tooling/env.js:43:24)
    at async runLesson (file:///back-end-development-and-apis/node_modules/@freecodecamp/freecodecamp-os/.freeCodeCamp/tooling/lesson.js:30:41)
    at async FSWatcher.<anonymous> (file:///back-end-development-and-apis/node_modules/@freecodecamp/freecodecamp-os/.freeCodeCamp/tooling/hot-reload.js:58:7)
🔴 ERROR:  2024-04-03 15:14:34 SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at getState (file:///back-end-development-and-apis/node_modules/@freecodecamp/freecodecamp-os/.freeCodeCamp/tooling/env.js:43:24)
    at async Object.getLesson (file:///back-end-development-and-apis/node_modules/@freecodecamp/freecodecamp-os/.freeCodeCamp/plugin/index.js:115:24)
    at async runLesson (file:///back-end-development-and-apis/node_modules/@freecodecamp/freecodecamp-os/.freeCodeCamp/tooling/lesson.js:33:7)
    at async FSWatcher.<anonymous> (file:///back-end-development-and-apis/node_modules/@freecodecamp/freecodecamp-os/.freeCodeCamp/tooling/hot-reload.js:58:7)
🟢 DEBUG:  2024-04-03 15:14:34 Watcher: change - /back-end-development-and-apis/.logs/.terminal_out.log
🟢 DEBUG:  2024-04-03 15:14:34 Watcher: change - /back-end-development-and-apis/.logs/.history_cwd.log

Looking at the file, it appears intact. So, the assumption is whilst content is being written to state.json, the file is also being read.

@ShaunSHamilton ShaunSHamilton added type: bug Something isn't working patch This issue/PR results in a patch release labels Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch This issue/PR results in a patch release type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant