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

Hanging process in Windows 10 with pandoc-fignos 0.8 #11

Closed
catdevrandom opened this issue Mar 29, 2016 · 8 comments
Closed

Hanging process in Windows 10 with pandoc-fignos 0.8 #11

catdevrandom opened this issue Mar 29, 2016 · 8 comments
Labels

Comments

@catdevrandom
Copy link

Hello,

I tried to use the 0.8 release in my Windows 10 installation, but I ran into a problem.
My system:

  • Windows 10 Home
  • Python 2.7.11
  • Pandoc 1.16.0.2 (same thing happened with 1.17.0.2 and I tried to reverted to 1.16.0.2; didn't fix the issue)
  • pandoc-fignos 0.8
  • pandocfilters 1.3.0

File test.md contained:

#Heading

Test text.

Command I used:

pandoc.exe --filter=pandoc-fignos.exe -t latex -o test.tex test.md

No output in the command line. The process hung indefinitely. I forcefully killed the processes using another Command Line window:

taskkill /F /IM  pandoc-fignos.exe 
taskkill /F /IM  python.exe

I had to repeat those commands many times, until they managed to kill tens of processes that were open and quickly eating up all my memory.

After the processes were killed, the original command line showed the error below, many times:

Traceback (most recent call last):
  File "C:\Python27\Scripts\pandoc-fignos-script.py", line 9, in <module>
    load_entry_point('pandoc-fignos==0.8', 'console_scripts', 'pandoc-fignos')()
  File "C:\Python27\lib\site-packages\pkg_resources\__init__.py", line 558, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "C:\Python27\lib\site-packages\pkg_resources\__init__.py", line 2682, in load_entry_point
    return ep.load()
  File "C:\Python27\lib\site-packages\pkg_resources\__init__.py", line 2355, in load
    return self.resolve()
  File "C:\Python27\lib\site-packages\pkg_resources\__init__.py", line 2361, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "C:\Python27\lib\site-packages\pandoc_fignos.py", line 57, in <module>
    output = subprocess.check_output([command, '-v'])
  File "C:\Python27\lib\subprocess.py", line 573, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['C:\\Python27\\Scripts\\pandoc-fignos.exe', '-v']' returned non-zero exit status 1
pandoc.exe: Error running filter pandoc-fignos.exe
Filter returned error status 1

Reverting back to pandoc-fignos 0.7.6 seemed to have fixed it.

Hope that is useful. Cheers!

@DancingQuanta
Copy link

Same issue here! It seems something is wrong with pandoc-fignos 0.8 especially with use of psutil.
i use cygwin and pandoc just hangs with pandoc-fignos and my task manager shows large number of pandoc.exe and pandoc-fignos.exe processes which eats up my memory so much I have to restart.

Are you trying to start a new pandoc process outside of first pandoc call just to get its version number? This may set up infinite loop because the new pandoc call appears to be with the fignos attached which cause a new pandoc process to start and so on.

My specs:
Windows 7 Home
Cygwin 2016-01-24
Python 3.4.4 :: Anaconda 2.5.0 (64-bit)
Pandoc 1.16.0.2
pandoc-fignos 0.8
pandocfilters 1.3.0

@tomduck
Copy link
Owner

tomduck commented Apr 2, 2016

Thank you both for your feedback, which is very helpful.

Yes, I am using a subprocess to get pandoc's version number. This is now required because of a patch made to the TeX writer in pandoc 1.17. I requested that pandoc pass along version numbers to filters, but no luck so far. This required finding another way.

psutil is used to determine the process that called pandoc-fignos. @catdevrandom: It would appear that psutil has identified your pandoc as residing at C:\\Python27\\Scripts\\pandoc-fignos.exe. Could you please confirm that for me?

It would appear from @DancingQuanta's info that it is the call to pandoc-fignos.exe that is hanging. That is really weird, because I am using the cross-platform subprocess module to do the call.

I should be able to carve out some time to work on this tonight. If either of you have any extra insights, please send them along. Cheers.

@catdevrandom
Copy link
Author

@tomduck: Sure, glad to help! :) Btw, thank you for the super useful filter!

Yes, the location of pandoc-fignos.exe is correct (I would have thought it would be installed inside site-packages, but that's where pip put it). pandoc.exe itself is in my user's AppData\Local\Pandoc folder.

Please let me know if you want me to test anything specific. I also have a Ubuntu installation in this machine, so I can try to compare behaviors, if that is of any help.

@catdevrandom
Copy link
Author

An idea...

If @DancingQuanta is correct, it could be that, in Windows, pandoc_fignos.py line 55:

command = psutil.Process(os.getpid()).parent().exe()

gives you not only the absolute path of the executable, but also the arguments that were used in that call. Does that make any sense? By the documentation of psutils, I wouldn't think so, but what else could explain the recursive calls to pandoc-fignos.exe?

If that is correct, maybe a quick and dirty solution could be that you parse the command variable before sending it to subprocess in line 57, to exclude any possible arguments after the executable name.

(Sorry I'm not proposing a patch myself, but I have a big deadline looming over my head... Messing with code now would be a perfect excuse for procrastinating indefinitely, and I know I shouldn't!)

@tomduck
Copy link
Owner

tomduck commented Apr 3, 2016

I think I got it. Please install pandoc-fignos 0.8.1 using pip (or your method of choice). If it works for you, then go ahead and close the Issue.

Thanks very much for your feedback. Much appreciated!

@DancingQuanta
Copy link

Things seems to be back to normal with 8.0.1 for my current setup, thank you!
Let wait for @catdevrandom to confirm.

@catdevrandom
Copy link
Author

I confirm that now it works with both Pandoc 1.16.0.2 and 1.17.0.2. Closing the issue.
Thank you!

@tomduck
Copy link
Owner

tomduck commented Apr 3, 2016

Excellent! Thanks again to you both.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants