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

Assertion failed downloading content from BaNaNaS. #8814

Closed
spnda opened this issue Mar 6, 2021 · 6 comments · Fixed by #8964
Closed

Assertion failed downloading content from BaNaNaS. #8814

spnda opened this issue Mar 6, 2021 · 6 comments · Fixed by #8964
Labels
needs triage This issue needs further investigation before it becomes actionable

Comments

@spnda
Copy link
Contributor

spnda commented Mar 6, 2021

Version of OpenTTD

master @ 2860de7

Expected result

It downloads the content fine (currently just tested NewGRFs).

Actual result

File: minknernel/crts/ucrt/src/appcrt/lowio/lseek.cpp
Line: 103

Expression: _osfile(fh) & FOPEN

Errors out at:

gzFile fin = gzdopen(dup(fileno(ftmp)), "rb");

Steps to reproduce

Build the game from master, run the game, try to download any newgrfs from the content downloader.
Using latest vcpkg with all packages updated to latest versions. (This seems to be a new recent issue, never encountered this before.) I also recently updated VS2019.

@spnda
Copy link
Contributor Author

spnda commented Mar 7, 2021

Some context when the exception is thrown. (Downloading Polish PKP Set 2.0.11)
image

The exact error message:

Unhandled exception at 0x00007FF84AF7AFEC (ucrtbased.dll) in openttd.exe: 
An invalid parameter was passed to a function that considers invalid parameters fatal.

@TrueBrain
Copy link
Member

TrueBrain commented Mar 8, 2021

I too have this issue. It also happens for me when I make a screenshot.

It only happens when I build a version myself; it does not happen with official binaries.

In VSCode, you have to hit "Ignore" first to get the debugger to tell you where it failed.

@TrueBrain
Copy link
Member

Error with whole map screenshot:

Exception has occurred: W32/0xC0000409
Unhandled exception at 0x00007FF9AF3CB7EC (ucrtbased.dll) in openttd.exe: An invalid parameter was passed to a function that considers invalid parameters fatal.

at screenshot.cpp, line 388. 387 is calling png_write_row.

@TrueBrain TrueBrain added the needs triage This issue needs further investigation before it becomes actionable label Mar 9, 2021
@PeterN
Copy link
Member

PeterN commented Apr 7, 2021

I switched from x64-windows to x64-windows-static (like the official binaries use) and this seems to have solved the issue. I wonder if there's some core DLL mismatch happening with the shared versions.

@PeterN
Copy link
Member

PeterN commented Apr 7, 2021

https://docs.microsoft.com/en-us/cpp/build/reference/md-mt-ld-use-run-time-library?view=msvc-160

string(REPLACE "/MD" "/MT" ${MSVC_FLAGS} "${${MSVC_FLAGS}}")

This line in CompileFlags.cmake is forcing use of the static LIBCMT[D] lib.
If the vcpkg dependencies are built as shared libraries, then they link with MSVCRT instead, causing the conflict.

This problem doesn't occur with the official binaries because they are built with static dependencies.

I would expect a warning about conflicts though, as you get when you DON'T use /MT when compiling against static libs...

@glx22
Copy link
Contributor

glx22 commented Apr 7, 2021

I guess it should be possible to analyse vcpkg triplets to determine compile flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage This issue needs further investigation before it becomes actionable
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants