vimlab / mdown.vim

Live markdown preview within [neo]vim
14 stars 3 forks source link

Infinite xdg-open threads #4

Open icaroperseo opened 7 years ago

icaroperseo commented 7 years ago

Hi!

I am currently having the following issue: Every time I run :Mpreview infinite xdg-open threads begin to be generated regardless of whether the browser is running or not, filling the RAM memory and swap until the system collapses. The threads continue to be generated despite closing the browser and editor. Killing processes does not seem to help (continue to be generated).

See below for details:

Both the operating system and the plug-in are up to date. So far I have not had any problems using xdg-open & Brave, so I have not tried to establish another browser as default. I hope I have been as specific as possible.

Best regards.

mklabs commented 7 years ago

Hi!

Thanks for the detailed explanation. This is related to the recent PR #3, @yousefamar did you run into similar issues with xdg-open ?

Unfortunately, I'm running osx and won't be able to test until this week end on a linux box.

icaroperseo commented 7 years ago

Hi @mklabs! Thanks for answering.

Investigating a little I found that the problem is O.S./xdg-open related, context: https://superuser.com/questions/1007807/xdg-open-hogging-the-cpu-by-forking-itself-endlessly

I have solved the problem by setting the following variable in my ~/.bashrc file (with the path to the browser you want to use):

export BROWSER=/usr/bin/brave

Previously I had never presented this situation, so I could not determine exactly where is the root of the issue (maybe it's the combination xdg-open & Brave browser but very surely I'm speculating).

Regards.

yousefamar commented 7 years ago

Hi @icaroperseo, that's weird indeed since I believe xdg-open is supposed to try opening by MIME type before resorting to BROWSER and that shouldn't be xdg-open by default unless something else is setting it.

Could you do me a favour and replace the line that loads this plugin in your init.vim with:

Plug 'yousefamar/mdown.vim', { 'branch': 'patch-1', 'do': 'npm install' }

then run

:PlugClean
:PlugInstall

and see if the issue still persists? This fork is identical to upstream, except that it opens the browser using node-open, which does exactly the same thing except it's bundled with it's own xdg-open script, meaning no external dependencies.

If it doesn't, and @mklabs is ok with it, then I'll make a PR to close this issue.

mklabs commented 7 years ago

@yousefamar Thanks for the detailed explanation. I'd be happy to merge it if you do.