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

Use more conservative pool_size #267

Merged
merged 11 commits into from
May 31, 2020
Merged

Conversation

renkun-ken
Copy link
Member

@renkun-ken renkun-ken commented May 30, 2020

Follows up #265.

The pool_size is altered to be more conservative for machines with fewer CPUs.

cpus<=3, pool_size=1
4<=cpus<=5, pool_size=2
cpus>=6, pool_size=3

@randy3k
Copy link
Member

randy3k commented May 30, 2020

Seeing this from the windows log now.

[2020-05-30 19:37:48.181] internal error: Error: cannot allocate vector of size 184 Kb
Stack trace:
1: get(x, envir = ns)
2: FUN(X[[i]], ...)
3: vapply(private$objects, function(x) {
    is.function(get(x, envir = ns))
}, logical(1L), USE.NAMES = FALSE)
4: .subset2(public_bind_env, "initialize")(...)
5: PackageNamespace$new(pkgname)
6: self$namespaces$set(pkgname, PackageNamespace$new(pkgname))
7: .subset2(public_bind_env, "initialize")(...)
8: Workspace$new(self$rootPath)
9: dispatch(self, id, params)
[2020-05-30 19:37:48.212] deliver:  ["Response", "Response", "Message", "R6"]
[2020-05-30 19:37:48.415] received:  Content-Length: 40
[2020-05-30 19:37:48.415] Error: stdin connection close

@randy3k
Copy link
Member

randy3k commented May 30, 2020

Maybe due to the supervise argument and there are lingering R processes after running testcases?

@randy3k
Copy link
Member

randy3k commented May 30, 2020

I think I have figured it out. It is actually not a windows only issue. It always occurs on macOS and Linux. It is just so happened that github Windows containers are more memory sensitive.

The real cause is that sometimes, the server process is never got killed despite that we have process$kill() in the finalize (maybe gc() was not triggered?).

The current workaround is to shut down the server peacefully using the "shutdown" method instead of using process$kill().

Here is a screenshot of my mac when the tests are running

Randy             4587  72.6  0.6  4458300 105344   ??  Rs    2:48PM   0:00.60 /Library/Frameworks/R.framework/Resources/bin/exec/R --slave -e languageserver::run(debug~+~=~+~'/private/tmp/languageserver.log')
Randy             4603  31.2  0.3  4365432  51680   ??  Ss    2:48PM   0:00.18 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             4602  27.6  0.3  4373624  52500   ??  Ss    2:48PM   0:00.18 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             4601  22.9  0.3  4365432  51128   ??  Ss    2:48PM   0:00.18 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             4600  21.5  0.3  4357240  50456   ??  Ss    2:48PM   0:00.18 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             4550   1.3  1.0  4516404 170064   ??  Ss    2:48PM   0:01.03 /Library/Frameworks/R.framework/Resources/bin/exec/R --slave -e languageserver::run(debug~+~=~+~'/private/tmp/languageserver.log')
Randy             2893   0.8  1.0  5354792 160404 s004  S+    2:47PM   0:03.73 /Library/Frameworks/R.framework/Resources/bin/exec/R --quiet -e devtools::test()
Randy             4564   0.7  0.4  4386040  66744   ??  Ss    2:48PM   0:00.31 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             4563   0.6  0.4  4378872  66900   ??  Ss    2:48PM   0:00.31 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy            98884   0.4  1.4  4659868 239884   ??  S     2:38PM   0:05.25 /Library/Frameworks/R.framework/Resources/bin/exec/R --quiet --slave -e languageserver::run()
Randy             3930   0.3  1.2  4550068 195324   ??  Ss    2:48PM   0:01.20 /Library/Frameworks/R.framework/Resources/bin/exec/R --slave -e languageserver::run(debug~+~=~+~'/private/tmp/languageserver.log')
Randy             4480   0.3  1.0  4509108 168520   ??  Ss    2:48PM   0:01.06 /Library/Frameworks/R.framework/Resources/bin/exec/R --slave -e languageserver::run(debug~+~=~+~'/private/tmp/languageserver.log')
Randy             4217   0.3  1.1  4534128 185492   ??  Ss    2:48PM   0:01.12 /Library/Frameworks/R.framework/Resources/bin/exec/R --slave -e languageserver::run(debug~+~=~+~'/private/tmp/languageserver.log')
Randy             4439   0.3  1.0  4501036 163804   ??  Ss    2:48PM   0:00.99 /Library/Frameworks/R.framework/Resources/bin/exec/R --slave -e languageserver::run(debug~+~=~+~'/private/tmp/languageserver.log')
Randy             4515   0.3  1.0  4517300 173240   ??  Ss    2:48PM   0:01.04 /Library/Frameworks/R.framework/Resources/bin/exec/R --slave -e languageserver::run(debug~+~=~+~'/private/tmp/languageserver.log')
Randy             4074   0.3  0.8  4549044 142216   ??  Ss    2:48PM   0:01.15 /Library/Frameworks/R.framework/Resources/bin/exec/R --slave -e languageserver::run(debug~+~=~+~'/private/tmp/languageserver.log')
Randy             2910   0.2  1.1  4550068 184932   ??  Ss    2:47PM   0:01.22 /Library/Frameworks/R.framework/Resources/bin/exec/R --slave -e languageserver::run(debug~+~=~+~'/private/tmp/languageserver.log')
Randy             3750   0.2  1.4  4596128 242564   ??  Ss    2:48PM   0:01.56 /Library/Frameworks/R.framework/Resources/bin/exec/R --slave -e languageserver::run(debug~+~=~+~'/private/tmp/languageserver.log')
Randy             4357   0.2  1.1  4525620 183248   ??  Ss    2:48PM   0:01.10 /Library/Frameworks/R.framework/Resources/bin/exec/R --slave -e languageserver::run(debug~+~=~+~'/private/tmp/languageserver.log')
Randy             2952   0.2  1.0  4533684 169724   ??  Ss    2:47PM   0:01.24 /Library/Frameworks/R.framework/Resources/bin/exec/R --slave -e languageserver::run(debug~+~=~+~'/private/tmp/languageserver.log')
Randy             4394   0.2  1.2  4545292 202076   ??  Ss    2:48PM   0:01.13 /Library/Frameworks/R.framework/Resources/bin/exec/R --slave -e languageserver::run(debug~+~=~+~'/private/tmp/languageserver.log')
Randy             3323   0.2  1.1  4574896 180248   ??  Ss    2:47PM   0:01.29 /Library/Frameworks/R.framework/Resources/bin/exec/R --slave -e languageserver::run(debug~+~=~+~'/private/tmp/languageserver.log')
Randy             3165   0.2  1.0  4550068 170316   ??  Ss    2:47PM   0:01.27 /Library/Frameworks/R.framework/Resources/bin/exec/R --slave -e languageserver::run(debug~+~=~+~'/private/tmp/languageserver.log')
Randy             3558   0.2  1.1  4541876 186640   ??  Ss    2:47PM   0:01.24 /Library/Frameworks/R.framework/Resources/bin/exec/R --slave -e languageserver::run(debug~+~=~+~'/private/tmp/languageserver.log')
Randy             3339   0.0  0.3  4365432  47552   ??  Ss    2:47PM   0:00.18 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             3338   0.0  0.3  4357240  46524   ??  Ss    2:47PM   0:00.18 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             3337   0.0  0.3  4365432  45940   ??  Ss    2:47PM   0:00.18 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             3336   0.0  0.3  4412176  51092   ??  Ss    2:47PM   0:00.32 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             3185   0.0  0.3  4365432  43688   ??  Ss    2:47PM   0:00.18 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             3184   0.0  0.3  4365432  45132   ??  Ss    2:47PM   0:00.18 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             3183   0.0  0.3  4365432  46048   ??  Ss    2:47PM   0:00.18 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             3182   0.0  0.3  4377848  52124   ??  Ss    2:47PM   0:00.31 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             2968   0.0  0.3  4357240  43944   ??  Ss    2:47PM   0:00.18 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             2967   0.0  0.3  4365432  44824   ??  Ss    2:47PM   0:00.18 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             2966   0.0  0.3  4373624  43032   ??  Ss    2:47PM   0:00.18 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             2965   0.0  0.3  4420368  50760   ??  Ss    2:47PM   0:00.33 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             2927   0.0  0.3  4374648  47076   ??  Ss    2:47PM   0:00.17 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             2926   0.0  0.3  4366456  42400   ??  Ss    2:47PM   0:00.18 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             2925   0.0  0.3  4357240  44352   ??  Ss    2:47PM   0:00.18 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             2924   0.0  0.4  4377848  62328   ??  Ss    2:47PM   0:00.32 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy            98928   0.0  0.6  4431676  93904   ??  Ss    2:38PM   0:02.53 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy            98927   0.0  0.6  4449084 107552   ??  Ss    2:38PM   0:03.20 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy            98926   0.0  0.3  4378824  57216   ??  Ss    2:38PM   0:00.96 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy            98925   0.0  0.3  4377028  58336   ??  Ss    2:38PM   0:00.94 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             4623   0.0  0.0  4268284    676 s001  S+    2:48PM   0:00.00 grep --color=auto exec/R
Randy             4566   0.0  0.3  4357240  51220   ??  Ss    2:48PM   0:00.18 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             4565   0.0  0.3  4365432  51336   ??  Ss    2:48PM   0:00.18 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             4531   0.0  0.3  4365432  51584   ??  Ss    2:48PM   0:00.20 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             4530   0.0  0.3  4365432  50484   ??  Ss    2:48PM   0:00.20 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             4529   0.0  0.3  4373624  50520   ??  Ss    2:48PM   0:00.19 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             4528   0.0  0.4  4386040  67264   ??  Ss    2:48PM   0:00.32 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             4496   0.0  0.3  4357240  52316   ??  Ss    2:48PM   0:00.20 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             4495   0.0  0.3  4365432  51004   ??  Ss    2:48PM   0:00.20 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             4494   0.0  0.3  4357240  51228   ??  Ss    2:48PM   0:00.20 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             4493   0.0  0.4  4386040  66748   ??  Ss    2:48PM   0:00.33 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             4457   0.0  0.3  4357240  52852   ??  Ss    2:48PM   0:00.18 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             4456   0.0  0.3  4357240  51160   ??  Ss    2:48PM   0:00.19 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             4455   0.0  0.3  4357240  51324   ??  Ss    2:48PM   0:00.19 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             4454   0.0  0.3  4357240  50432   ??  Ss    2:48PM   0:00.19 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             4414   0.0  0.3  4365432  51700   ??  Ss    2:48PM   0:00.18 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             4413   0.0  0.3  4357240  50524   ??  Ss    2:48PM   0:00.18 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             4412   0.0  0.3  4365432  51780   ??  Ss    2:48PM   0:00.18 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             4411   0.0  0.4  4420368  68708   ??  Ss    2:48PM   0:00.33 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             4373   0.0  0.3  4365432  51384   ??  Ss    2:48PM   0:00.19 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             4372   0.0  0.3  4365432  50324   ??  Ss    2:48PM   0:00.19 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             4371   0.0  0.4  4377744  66208   ??  Ss    2:48PM   0:00.31 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             4370   0.0  0.4  4378872  67616   ??  Ss    2:48PM   0:00.32 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             4233   0.0  0.3  4357240  51156   ??  Ss    2:48PM   0:00.18 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             4232   0.0  0.4  4423720  74196   ??  Ss    2:48PM   0:00.45 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             4231   0.0  0.3  4357240  51428   ??  Ss    2:48PM   0:00.18 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             4230   0.0  0.4  4369656  67188   ??  Ss    2:48PM   0:00.32 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             4090   0.0  0.2  4373624  34504   ??  Ss    2:48PM   0:00.18 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             4089   0.0  0.2  4365432  35300   ??  Ss    2:48PM   0:00.18 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             4088   0.0  0.2  4365432  38040   ??  Ss    2:48PM   0:00.18 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             4087   0.0  0.3  4420368  45664   ??  Ss    2:48PM   0:00.33 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             3946   0.0  0.1  4365432  23856   ??  Ss    2:48PM   0:00.18 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             3945   0.0  0.1  4365432  22724   ??  Ss    2:48PM   0:00.18 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             3944   0.0  0.1  4365432  24592   ??  Ss    2:48PM   0:00.18 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             3943   0.0  0.3  4377848  56160   ??  Ss    2:48PM   0:00.33 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             3766   0.0  0.3  4373624  46436   ??  Ss    2:48PM   0:00.19 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             3765   0.0  0.3  4365432  46408   ??  Ss    2:48PM   0:00.18 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             3764   0.0  0.3  4357240  45784   ??  Ss    2:48PM   0:00.18 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             3763   0.0  0.4  4420368  68036   ??  Ss    2:48PM   0:00.34 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             3579   0.0  0.3  4357240  48368   ??  Ss    2:47PM   0:00.18 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             3578   0.0  0.3  4357240  46860   ??  Ss    2:47PM   0:00.18 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             3577   0.0  0.3  4365432  45620   ??  Ss    2:47PM   0:00.18 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore
Randy             3576   0.0  0.4  4412176  63692   ??  Ss    2:47PM   0:00.33 /Library/Frameworks/R.framework/Resources/bin/exec/R --no-readline --slave --no-save --no-restore

@randy3k
Copy link
Member

randy3k commented May 30, 2020

I think we no longer need R_LANGSVR_TEST_FAST = "NO" with 9d2c5ee. But to play safe, I reckon that we should keep it although the tests take much longer to run now.

@qinwf
Copy link
Contributor

qinwf commented May 30, 2020

The real cause is that sometimes, the server process is never got killed despite that we have process$kill() in the finalize (maybe gc() was not triggered?).

It feels like I write delete in C, but it is not actually deleting things.

@renkun-ken
Copy link
Member Author

Thanks for figuring it out! Quite a tricky problem.

LGTM. Please feel free to merge if nothing is to be added.

@randy3k randy3k merged commit 54fef7a into REditorSupport:master May 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants