marlonfan / coc-phpls

🐭 php language server for coc.nvim
MIT License
212 stars 16 forks source link

upstream bug: Intelephense 1.3.5+ hangs for 2 minutes when activating a license behind proxy #42

Closed cprn closed 4 years ago

cprn commented 4 years ago

Describe the bug On initialisation Intelephense fails after 2 minutes when trying to read the workspace state, even though at first it's empty. After timing out it properly re-indexes the project and saves its state. On next open it hangs again and this time doesn't write (probably because there are no changes). I just need a confirmation this isn't vim/coc-phpls related before I open an issue upstream.

To Reproduce Steps to reproduce the behavior:

  1. Install vim
  2. Install coc.nvim
  3. Install coc-phpls
  4. Open any PHP project

Expected behavior I expect Intelephense to load quickly, not hang while reading state and then timeout.

Screenshots Related parts of :CocInfo output:

## versions
vim version: NVIM v0.3.8
node version: v12.13.0
coc.nvim version: 0.0.74-bc017b02e6
term: screen-256color
platform: linux

## Output channel: phpls
[Info  - 15:09:55] Initialising intelephense 1.3.5
[Info  - 15:09:55] Reading state from /home/user/.config/coc/extensions/coc-phpls-data/674614e2.
[Warn  - 15:12:06] undefined
[Info  - 15:12:06] Initialised in 130624 ms
[Info  - 15:12:06] Intelephense 1.2.3
[Info  - 15:12:06] Indexing started.
[Info  - 15:12:07] Indexing ended. 98 files indexed in 1s.
[Info  - 15:12:07] Indexing started.
[Info  - 15:12:22] Indexing ended. 10169 files indexed in 14s.
[Info  - 15:12:22] Writing state to /home/user/.config/coc/extensions/coc-phpls-data/674614e2.
[Info  - 15:12:23] Wrote state in 1.7s.

coc-settings.json:

{   
    "intelephense.licenceKey": "***",
    "intelephense.files.exclude": ["var"]
}

Desktop (please complete the following information):

marlonfan commented 4 years ago

@cprn Can you turn on verbose so I can see CocInfo?

cprn commented 4 years ago

@marlonfan

Replaced my licence key in log with ***. Licence activation issue is due to proxy - I don't want to bother admin each time I reinstall from scratch.

cprn commented 4 years ago

"Reading state from" happens in node_modules/intelephense/lib/intelephense.js so I'm posting this upstream.

cprn commented 4 years ago

OK, so I was testing this some more to open a concise issue upstream and I found out Intelephense hangs on reading state only when I have intelephense.licenceKey set in coc-settings.json. It might only be happening when I'm behind proxy but can't confirm (I don't have unguarded environment at the moment).

cprn commented 4 years ago

I confirmed with Wireshark this is caused by Intelephense trying to connect to the license server directly (i.e. not respecting environment proxy settings). Ben Mewburn stated in this comment the value is taken from process.env.https_proxy setting but there's no such thing in CoC's schema.json and I have all the possible proxy-related variables set up in my ~/.bashrc file. Also I never had to set up proxy in coc-settings.json before and it was correctly detected from environment. I'm posting this upstream but leaving this issue open so that people could find it easily until it's resolved.

cprn commented 4 years ago

Can be closed, fixed upstream: bmewburn/vscode-intelephense#915.