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

Odd number of vCPUs causes invalid array length in tinypool #469

Closed
6 tasks done
englishtom opened this issue Mar 3, 2023 · 0 comments · Fixed by #470
Closed
6 tasks done

Odd number of vCPUs causes invalid array length in tinypool #469

englishtom opened this issue Mar 3, 2023 · 0 comments · Fixed by #470
Labels
to triage This issue needs to be triaged

Comments

@englishtom
Copy link
Contributor

Describe the bug

When running Histoire in a containerised environment (Docker etc) which has been configured with an odd number of cpus e.g 3, 5, 7, 9 Histoire calculates the number of threads to use as a double e.g 1.5, 2.5, 3.5, 4.5.

This double is then passed to Tinypool which attempts to initialise an array using the double e.g. new Array(1.5) which causes an error.

I will submit a PR which changes the way that Histoire calculates the number of threads using Math.floor to ensure the final result is an integer.

Reproduction

I'm unable to provide a reproduction as I'm not able to configure the number of vCPUs on StackBlitz, however, I believe my description is sufficient to understand the issue.

System Info

System:
    OS: Linux 5.10 Debian GNU/Linux 10 (buster) 10 (buster)
    CPU: (5) x64 Intel(R) Core(TM) i5-9600K CPU @ 3.70GHz
    Memory: 2.73 GB / 3.84 GB
    Container: Yes
    Shell: 5.0.3 - /bin/bash
  Binaries:
    Node: 16.19.1 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 8.19.3 - /usr/local/bin/npm
  npmPackages:
    @histoire/plugin-svelte: ^0.15.8 => 0.15.8 
    histoire: ^0.15.8 => 0.15.8 
    vite: ^4.0.0 => 4.1.3

Used Package Manager

npm

Validations

@englishtom englishtom added the to triage This issue needs to be triaged label Mar 3, 2023
englishtom pushed a commit to englishtom/histoire that referenced this issue Mar 3, 2023
Ensuring that `threadsCount` results in an integer rather than a double.
Akryum pushed a commit that referenced this issue Mar 16, 2023
… double when cpus is an odd number. (Fixes #469 ) (#470)

Co-authored-by: Thomas English <tom.english@stereocreative.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
to triage This issue needs to be triaged
Projects
None yet
1 participant