question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build finish successfully but get stuck and not exit

See original GitHub issue

Describe the bug When running yarn build the build finishes successfully but does not exit. This cause an issue with automating builds.

To Reproduce I have boiled down the issue to having setInterval in a script.

<script>
  let time = 1;
  setInterval(() => {
    time += 1;
  }, 1000);
</script>

{time}

A solution to this is of course to use onMount

<script>
  import { onMount } from "svelte";

  let time = 1;
  onMount(() => {
    setInterval(() => {
      time += 1;
    }, 1000);
  })
</script>

{time}

Expected behavior I’m not sure if this is expected behavior or not but, In Sapper this did not happen, the first snippet of code run just fine.

Severity Not severe since there is a workaround but I think it maybe need to be documented.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mattpilottcommented, Apr 17, 2021

this works with the new structure:

adapter: {
   adapt: static
},
1reaction
Conduitrycommented, Apr 11, 2021

Interesting. I’m not entirely sure why it’s causing a hang in SvelteKit but not in Sapper. But, regardless, having a setInterval without a clearInterval is a bad idea, because of memory leaks. And that’s especially a problem on the server, where every single time someone loads a page that contains that component, it creates another setInterval, which then hangs around forever.

I think the path forward here is not to make it not hang, but to do something to warn people that this is a bad thing to be doing. In SSR, there’s not really a reason to be creating an interval (or a timeout) at all, because it’s not going to fire until after the SSR’d HTML is rendered. I don’t know what’s an effective way to warn about this. Static analysis won’t really help. Do we override these globals with our own versions, and display a warning if we detect that one is being run during the synchronous period that the server-side rendering is happening? I’m not sure.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Visual Studio hangs constantly during build - Stack Overflow
In Visual Studio, go to Tools / Options / Projects & Solutions / Build And Run, then check the MSBuild project build output...
Read more >
Cancelling a build doesn't always work properly, leaving the ...
Starting a build of a solution, then choosing cancel from the build menu often causes VS to 'hang' indefinitely. The hang is not...
Read more >
[Support Guide] Hung or stuck, but seemingly successful build
If even one thing gets stuck, the process won't terminate and we end up with a stuck build. Is it possible you are...
Read more >
Build stuck on final "exit 0" - Jenkins Jira
After executing successfully the shell script the workers remain stuck for 10 minutes on the final "exit 0".
Read more >
Troubleshoot Microsoft Defender for Endpoint onboarding ...
If the onboarding completed successfully but the devices are not ... Defender for Endpoint Policy registry key does not exist or the OMA...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found