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

pandoc -h segmentation fault on windows 7 #4283

Closed
stepht opened this issue Jan 20, 2018 · 54 comments
Closed

pandoc -h segmentation fault on windows 7 #4283

stepht opened this issue Jan 20, 2018 · 54 comments

Comments

@stepht
Copy link

stepht commented Jan 20, 2018

segv for pandoc -h occurs on both pandoc 2.1.1 and 2.0.6 on windows 7
note that pandoc seems to work fine only -h (--help) is affected

@mb21
Copy link
Collaborator

mb21 commented Jan 20, 2018

Sounds like #4021 (maybe we should reopen that issue?)

@stepht can you post exact output? and also try pandoc --version?

@stepht
Copy link
Author

stepht commented Jan 20, 2018

maybe but pandoc --version is fine.

@jgm
Copy link
Owner

jgm commented Jan 20, 2018 via email

@jgm
Copy link
Owner

jgm commented Jan 20, 2018

@stepht Could you try the most recent build, available here?
https://ci.appveyor.com/project/jgm/pandoc/build/artifacts
I used a flag which has been described as a workaround for what might be our problem.
I'd also be curious whether this flag affects performance or functionality at all.

@stepht
Copy link
Author

stepht commented Jan 21, 2018

I have just tried the build but the exact same problem persists with -h. sorry

jgm added a commit that referenced this issue Jan 21, 2018
This didn't help with the problem #4283.
@mb21
Copy link
Collaborator

mb21 commented Jan 22, 2018

@stepht can you post exact output please?

@agusmba
Copy link
Contributor

agusmba commented Jan 22, 2018

FWIW, latest appveyor build is working (only tested the -h option) on my Win 7 box.

@stepht
Copy link
Author

stepht commented Jan 24, 2018

Sorry for the delay. I investigated a bit.
First on a conemu64 pandoc -h (as given in the latest build in this thread) goes to completion
without segfault the last two llines being -v and -h.

On mintty (both cyg32 and cyg64) pandoc -h segfaults but gives the same full output as inside conemu64:

% stephan@armen (/c/xopt/pt/pandoc-windows-i386) %
% ./pandoc.exe -h | tail -n 10
--fail-if-warnings
--log=FILE
--bash-completion
--list-input-formats
--list-output-formats
--list-extensions[=FORMAT]
--list-highlight-languages
--list-highlight-styles
-v --version
-h --help
Segmentation fault

Finally on normal cmd console, pandoc -h gives the full output, than hangs about two seconds
and then gives a dialog box with:
pandoc.exe stopped working. windows is looking for a solution
a button gives the possibility to debug.
(the dialog is acctually in spanish as the O.S is a spanish w7 (es_ES so to speak)

I also used the Listsdlls program from sysinternals to check dll loading
but did not see anything suspicious... the wow64 dlls are used correctly
cheers hth

@agusmba
Copy link
Contributor

agusmba commented Jan 24, 2018

Ok, reading @stepht I should add that I tested it from conemu also (and it worked).
I'll try to repeat stepht's tests on my win7 box tomorrow (at work) to get a possible confirmation.

EDIT (after testing pandoc -h today):

Combination Results
conemu + git-bash OK
conemu + cmd(32) OK
cmd(32) full output + stopped working...
cmd(64) full output + stopped working...
git-bash full output + segfault
vscode terminal + git-bash full output + segfault

My box is also a spanish w7 like stepht 's

Pandoc under test is from appveyor four days ago (2.0.1 works fine)

@ataulien
Copy link

ataulien commented Feb 2, 2018

Just reporting that I have got the exact same issue on my Win7-Machine. So far I have tested Pandoc versions 2.1.1 (segfaults) and 2.0.1.1 (works).

This also causes pypandoc to fail to install, since it sees a non-zero exit code when getting the list of supported formats.

@agusmba
Copy link
Contributor

agusmba commented Feb 2, 2018

@ataulien could you clarify what pandoc call is segfaulting for you? So far (AFAIK) we had only identified pandoc -h

@ataulien
Copy link

ataulien commented Feb 2, 2018

It seems to be this invocation of pandoc, which is causing issues: https://github.com/bebraw/pypandoc/blob/master/pypandoc/__init__.py#L347

 p = subprocess.Popen(
        [__pandoc_path, '--list-output-formats'],  # <--------- This is passed to the pandoc-process
        stdin=subprocess.PIPE,
        stderr=subprocess.PIPE,
        stdout=subprocess.PIPE)

    comm = p.communicate()
    out = comm[0].decode().splitlines(False)
    if p.returncode != 0:      # <------ returncode is not 0, this makes it check for an older version, which obviously fails and causes the setup to break
        # try the old version and see if that returns something
        return get_pandoc_formats_pre_1_18()

As seen from the sourcecode, the --list-output-formats seems to cause the segfault. I could reproduce this on the commandline by calling pandoc --list-output-formats directly.

Pandoc also crashes if you give it a garbage argument, like pandoc --whatever, after printing the usual "unknown argument, try --help".

However, using Pandoc like pandoc somefile.md --output test.docx does not result in a crash.

@agusmba
Copy link
Contributor

agusmba commented Feb 2, 2018

Ok, after a quick test, it seems that all pandoc (v > 2.0.1) invocations with --list-* argument also segfaults in Windows 7

@jgm
Copy link
Owner

jgm commented Feb 2, 2018 via email

@mb21
Copy link
Collaborator

mb21 commented Mar 12, 2018

Trying to find the common denominator here. So far we have two reports of pandoc --help and relates commands segfaulting on Windows 7 6.1.7601 Service Pack 1 Build 7601 (@RobertZenz and @robinerd are you both 64bit?).

Is it something with that build or can you guys reproduce on other versions of Windows 7?

@robinerd
Copy link

@mb21 I'm on a 64-bit system. I'm unfortunately not able to test other windows versions as I'm on a work computer.

@robinerd
Copy link

robinerd commented Mar 12, 2018

I can also confirm that all --list-* parameters are crashing (given one at a time). Their usual output is still printed before the crash.

EDIT: Running from cmd, getting the windows dialogue saying Pandoc.exe has stopped working. Same commands in a Cygwin bash give Segmentation fault instead.

@robinerd
Copy link

Additional observations (don't know if relevant):
Running cmd as admin doesn't change the behaviour.
Tried to cd into pandoc.exe's folder first, same behaviour.
There's approximately 1 second of delay between the last printed output and the crash, applies both for cmd->dialogue and cygwin->segfault (could be operating system related though)

@mb21
Copy link
Collaborator

mb21 commented Mar 12, 2018

If you can build pandoc from source on the affected system, it would also be interesting to see whether that would fix it (then the problem would only be in our provided windows binary).

@robinerd
Copy link

@mb21 I'm trying that now. Ran into some download issues with local proxies at first but it's compiling now. Will let you know the results soon!

@robinerd
Copy link

After running stack install --test I got the below output. Can't find any pandoc.exe produced. Please guide me if there are any logs or more details I can provide you with :)

...
lifted-base-0.2.3.11: download
x509-1.7.2: copy/register
hxt-9.3.1.16: build
hslua-module-text-0.1.2.1: configure
unordered-containers-0.2.8.0: copy/register
tasty-hunit-0.9.2: download
attoparsec-0.13.2.0: copy/register
tasty-quickcheck-0.9.1: download
Progress: 87/118Segmentation fault/access violation in generated code

@mb21
Copy link
Collaborator

mb21 commented Mar 12, 2018

can you try stack install (so you don't have to build the tests)?

@robinerd
Copy link

Compiled successfully with stack install, and the problem seems to be gone!
Tested with -h and --list-output-formats, from cmd. Output is produced, and no crash!
Let me know if you need additional support 👍

@mb21
Copy link
Collaborator

mb21 commented Mar 12, 2018

That's great to know! The problem is then somewhere in our appveyor build... not sure we can change those to work for Windows 7 without breaking others things though... @jgm?

Either way, building from source seems to be a workaround for those of you on Windows 7.

jgm added a commit that referenced this issue Mar 12, 2018
@jgm
Copy link
Owner

jgm commented Mar 12, 2018

Let's see if this last change helps, using an earlier version of VS.

@RobertZenz
Copy link

Just for the log, no change for me with 2.1.3, still crashing.

@jgm jgm mentioned this issue Mar 27, 2018
@VladimirAlexiev
Copy link
Contributor

VladimirAlexiev commented Apr 11, 2018

2.1.3 also crashes for me: cygwin, win7 64bit, mintty or cmd (works fine in conemu).
In cmd it gives this APPCRASH (in mintty just says Segmentation fault):

 Problem Event Name:	APPCRASH
  Application Name:	pandoc.exe
  Application Version:	0.0.0.0
  Application Timestamp:	00000000
  Fault Module Name:	pandoc.exe
  Fault Module Version:	0.0.0.0
  Fault Module Timestamp:	00000000
  Exception Code:	c0000005
  Exception Offset:	02a485a3
  OS Version:	6.1.7601.2.1.0.256.48
  Locale ID:	1033
  Additional Information 1:	97a8
  Additional Information 2:	97a8436993a2b3cc908d142fe2ee7ba2
  Additional Information 3:	5a07
  Additional Information 4:	5a07d4cda277a8856bbc6177ae279d97

It crashes on commands that spit out internal info: --list-input-formats --list-extensions --bash-completion --help (but not --version)

@RobertZenz
Copy link

Good news, the 2.2 x64 build works for me again under Windows 7 x64. However, the i386 build still fails in the same way.

@jgm
Copy link
Owner

jgm commented Apr 30, 2018 via email

@yomannnn
Copy link

yomannnn commented May 1, 2018

Hi, I can confirm that on my Win7 machine the crash disappeared after installing "pandoc-2.2-windows-x86_64.msi". Many thanks for the fix.

@agusmba
Copy link
Contributor

agusmba commented May 3, 2018

v2.2 64bit is working for me also.
Thanks!

@GoLangsam
Copy link

pandoc 2.2.1 i386 build on 32bit Win7 (up-to-date):
pandoc -h and all kinds of listings issue pandoc.exe has stopped working.

@jgm
Copy link
Owner

jgm commented May 21, 2018

@GoLangsam - are you on a 32 bit or 64 bit machine?
Many of the others above who had this issue with the 32-bit build were able to use the 64-bit build without problems.

@GoLangsam
Copy link

@jgm - good ol' 32bit it is ☹️

@nehaljwani
Copy link

nehaljwani commented Sep 2, 2018

Faced the same issue on pandoc 2.2.3.2 on Windows, 32bit.
(Not so?) Surprisingly, when I download stack.exe (Windows, 32bit) and then run .\stack.exe --help, I see the same crash.

@nehaljwani
Copy link

Could be related to https://ghc.haskell.org/trac/ghc/ticket/15154#no1

@jgm
Copy link
Owner

jgm commented Sep 3, 2018 via email

@jgm
Copy link
Owner

jgm commented Sep 7, 2018

Could someone try the 32-bit build here to see if the issue is still there?
https://ci.appveyor.com/project/jgm/pandoc/build/1.0.2784/job/vu57xw797lwkv1hr/artifacts

I've made some improvements to the build process. We're still using ghc 8.2.2, though, for the 32-bit builds, because of segfaults building with 8.4.3.

@jgm
Copy link
Owner

jgm commented Sep 11, 2018

I'd really like to figure out whether this issue has been resolved. Can any of you who previously got segfaults with the 32-bit windows build try out the package linked in my last comment?
@nehaljwani @GoLangsam @RobertZenz @agusmba @robinerd @stepht

@agusmba
Copy link
Contributor

agusmba commented Sep 12, 2018

Hi @jgm, I didn't have problems with the 32-bit windows build, since I was using the 64bit one, but I just tried the 32-bit windows build you provided (zip) on my machine, and got a segfault from cmd.

I also fired up a Win7-32bit VM to test it on a 32bit system and it also segfaults.

Sorry.

Hopefully someone else will have better results.

Edited: Just to make sure the failure was not related to using the zip pack, I also tested the latest appveyor 64bit version (zip) on and it works.

@mb21
Copy link
Collaborator

mb21 commented Sep 12, 2018

@agusmba uh, segfaults on which commands? -h, --version and/or --list-output-formats or even when doing conversions?

@agusmba
Copy link
Contributor

agusmba commented Sep 12, 2018

@mb21 sorry I didn't specify, but I was referring only to the -h or --list-output-formats that were giving us problems. --version works, and conversions too.

@nehaljwani
Copy link

Sorry, I was traveling. I tried the new binary. Still segfaults on --help just like before.

@jgm
Copy link
Owner

jgm commented Sep 12, 2018 via email

@jgm
Copy link
Owner

jgm commented Sep 26, 2018

OK, I've now got pandoc building on appveyor with ghc 8.6.1.1. Can one of you try the latest 32-bit windows binary to see if the segfault issue has been fixed?
https://ci.appveyor.com/project/jgm/pandoc/build/job/0o6vdkvg18yqsmyk/artifacts

@nehaljwani
Copy link

Just checked, doesn't seem to segfault now. All good!

@jgm
Copy link
Owner

jgm commented Sep 27, 2018

Excellent! That makes sense; the segfault issue is mentioned in the ghc 8.6 changelog, so I expected this would fix it.

@jgm jgm closed this as completed Sep 27, 2018
@nehaljwani
Copy link

@jgm Would you be uploading the latest artifacts in the release section for 2.3 or those will be part of the next release?

@jgm
Copy link
Owner

jgm commented Sep 27, 2018 via email

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

No branches or pull requests