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(Worker): Not loading latest version of specified script #6116

Closed
wongjiahau opened this issue Jun 5, 2020 · 8 comments · Fixed by #8328
Closed

bug(Worker): Not loading latest version of specified script #6116

wongjiahau opened this issue Jun 5, 2020 · 8 comments · Fixed by #8328
Assignees
Labels
bug Something isn't working correctly cli related to cli/ dir

Comments

@wongjiahau
Copy link
Contributor

wongjiahau commented Jun 5, 2020

Steps to reproduce

  1. Create a file script.ts with the content console.log('hello').
  2. Create another file main.ts with the following content:
while(true) {
  const worker = new Worker('./script.ts', {type: 'module'})
  await new Promise(resolve => setTimeout(resolve, 1000))
  worker.terminate()
}
  1. Run this command: deno run --allow-read main.ts.
  2. Modify the content of script.ts to console.log('bye') and save it.

Expected result

The subsequent log of deno run --allow-read main.ts should be bye.

Actual result

After step 4, the subsequent log of deno run --allow-read main.ts is still hello.

Environment:

macOS Catalina (v10.15.4)
$ deno --version
deno 1.0.5
v8 8.4.300
typescript 3.9.2

Is this introduced lately?

No, this is happening on every version of Deno since v1.0.0 until v1.0.5.

Current workaround

Refer https://stackoverflow.com/a/41790024/6587634

@ry ry added bug Something isn't working correctly cli related to cli/ dir labels Jun 5, 2020
@ry
Copy link
Member

ry commented Jun 5, 2020

Thanks for the report. I guess it's related to our module cache - it should be bypassed for dynamic loads (Worker constructors and dynamic imports).

@bartlomieju what do you think?

@bartlomieju
Copy link
Member

Yes, this is the same problem as in #5631 and #4743

@kitsonk
Copy link
Contributor

kitsonk commented Oct 26, 2020

While it hasn't fixed #5631 and #4743, I believe the compiler refactor has fixed this one, but I need to create a test to validate that.

@ry
Copy link
Member

ry commented Nov 10, 2020

I just tried the reproduction with 1.5.2 and it works as expected.

@ry ry closed this as completed Nov 10, 2020
@ry
Copy link
Member

ry commented Nov 10, 2020

Sorry - I didn't understand the example correctly. This is still a bug.

@ry ry reopened this Nov 10, 2020
kitsonk added a commit that referenced this issue Nov 16, 2020
Fixes #4743
Closes #5253
Fixes #5631
Fixes #6116

Co-authored-by: Bartek Iwańczuk <[email protected]>
Co-authored-by: Luca Casonato <[email protected]>
jannes pushed a commit to jannes/deno that referenced this issue Dec 1, 2020
@dev-nicolaos
Copy link
Contributor

dev-nicolaos commented Oct 31, 2022

This bug appears to have come back. I setup the steps to reproduce from the OP today running Deno v1.27.0 on Windows and did not get the expected result. After changing the text in script.ts and saving the file Deno continued to print the original string. I also tried closing the worker from itself (self.close) rather than using worker.terminate but got the same unexpected behavior.

@bartlomieju
Copy link
Member

@dev-nicolaos can you please open a new issue?

@dev-nicolaos
Copy link
Contributor

@bartlomieju I've opened #16503

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly cli related to cli/ dir
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants