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

Add-ons server inaccessible with MSVC build #6171

Closed
Wedge009 opened this issue Oct 7, 2021 · 13 comments
Closed

Add-ons server inaccessible with MSVC build #6171

Wedge009 opened this issue Oct 7, 2021 · 13 comments
Labels
Add-ons Issues with the add-ons client and/or server. Bug Issues involving unexpected behavior. Building Build-time issues. Network Issues in the networking API. Services Issues involving Wesnoth.org and other project services. Windows OS-specific issues that apply to Microsoft Windows

Comments

@Wedge009
Copy link
Member

Wedge009 commented Oct 7, 2021

Game and System Information

Self-compiled 1.15.18+dev (9c2ad49) and 1.17.0+dev (e49b5c7) on Windows 7.

Describe the bug

Attempting to access the add-ons server results in a 'Remote host disconnected' error message. Logs report:

error network: network_asio::error thrown during transaction with add-on server; "The handle is invalid"
error general: Remote host disconnected.

Attempting to access the add-ons server a second time results in a crash...

In contrast, there are no issues with logging in to the MP server. Accessing the add-ons server is fine on 1.14.17 release on Windows 7. No such issues on Linux.

To Reproduce

  1. On Windows 7 start Wesnoth 1.15+.
  2. Click Add-ons in the main menu.
  3. Click Connect.
  4. Repeating steps 2 and 3 results in a crash.

Expected behaviour

List of add-ons for the running Wesnoth version is downloaded and then displayed.

Additional context

https://forums.wesnoth.org/viewtopic.php?t=54955 may be related as it has the same symptoms but the exception message is different. Like the reporter there, accessing the web page from Internet Explorer is fine.

@Wedge009 Wedge009 added Bug Issues involving unexpected behavior. Windows OS-specific issues that apply to Microsoft Windows Network Issues in the networking API. Services Issues involving Wesnoth.org and other project services. Add-ons Issues with the add-ons client and/or server. Regression Issues that were not present in previous releases. labels Oct 7, 2021
@Wedge009
Copy link
Member Author

Wedge009 commented Oct 7, 2021

Running in debug mode doesn't have the crash on second connection attempt so maybe there's a race condition or something happening.

Stack trace:

wesnoth.exe!addons_client::wait_for_transfer_done(const std::string & status_message, addons_client::transfer_mode mode) Line 694	C++
wesnoth.exe!addons_client::connect() Line 81	C++
wesnoth.exe!`anonymous namespace'::addons_manager_ui(const std::string & remote_address) Line 77	C++
wesnoth.exe!manage_addons() Line 248	C++
wesnoth.exe!gui2::dialogs::title_screen::pre_show::__l2::<lambda>() Line 288	C++

Upon attempting to connect to the add-ons server the exception seems to be thrown when showing the little dialogue that would normally show download progress.

try {
addons_client client(remote_address);
client.connect();
gui2::dialogs::addon_manager dlg(client);
dlg.show();
need_wml_cache_refresh = dlg.get_need_wml_cache_refresh();
} catch(const config::error& e) {
ERR_CFG << "config::error thrown during transaction with add-on server; \""<< e.message << "\"" << std::endl;
gui2::show_error_message(_("Network communication error."));
} catch(const network_asio::error& e) {
ERR_NET << "network_asio::error thrown during transaction with add-on server; \""<< e.what() << "\"" << std::endl;
gui2::show_error_message(_("Remote host disconnected."));
} catch(const filesystem::io_exception& e) {
ERR_FS << "filesystem::io_exception thrown while installing an addon; \"" << e.what() << "\"" << std::endl;
gui2::show_error_message(_("A problem occurred when trying to create the files necessary to install this add-on."));
} catch(const invalid_pbl_exception& e) {
ERR_CFG << "could not read .pbl file " << e.path << ": " << e.message << std::endl;

wait_for_transfer_done(msg, transfer_mode::connect);

gui2::dialogs::network_transmission stat(*cd, _("Add-ons Manager"), status_message);
if(!stat.show()) {
// Notify the caller chain that the user aborted the operation.
if(mode == transfer_mode::connect) {
throw user_disconnect();
} else {
throw user_exit();
}
}

At that point I just get the exception network_asio::error with message 'The handle is invalid'. Not sure what handle that is. (Edit: setting a break-point at all the times network_asio.cpp throws an error didn't come up with anything, but they may be different error objects.)

@Pentarctagon
Copy link
Member

Does it happen with the Steam or SourceForge versions, since those are compiled in a different way (assuming you're compiling with VS yourself)?

@Wedge009
Copy link
Member Author

I just retried using 1.15.18 win64 downloaded from SourceForge. Strange, seems to work just fine. I'll try a full recompile, it was working fine previously...

(Yeah, self-compiled in VS2019.)

As an aside, I confirmed #4508 still happens with the official build (it's using SDL 2.0.12) so that one definitely isn't me doing something wrong/different.

@Wedge009 Wedge009 added Building Build-time issues. and removed Regression Issues that were not present in previous releases. labels Oct 10, 2021
@Wedge009
Copy link
Member Author

Hmm, no difference. The relevant differences I'm seeing in the Libraries report is that I'm using boost 1.77 over 1.74, openssl 1.1.1l over 1.1.1i and SDL 2.0.16 over 2.0.12. boost 1.77 has been around since August, I'm pretty sure Add-ons were working before that but maybe it really is just a case of something I'm doing differently.

Closing as 'not an issue' (from project's point of view).

@Pentarctagon
Copy link
Member

The official Windows builds don't use VS, they're cross-compiled from Linux, so that's a big difference (even though in a perfect world they'd be entirely similar).

@Wedge009
Copy link
Member Author

Yes, I'm aware of that - or at least that they aren't built from MSVC.

@Pentarctagon
Copy link
Member

Something you could try if you're feeling adventurous would be to see if wesnoth can be built with clang instead, and if that works see if the same bug still occurs.

@Wedge009
Copy link
Member Author

Thanks for the suggestion. I decided to leave it for now as I got stuck on boost dependencies - it requires boost generated by clang rather than msvc in which case I wonder if I'm better off trying again with boost 1.74 instead, since network_asio appears to be built atop boost.

@Pentarctagon
Copy link
Member

Alright. Are you able to check if this happens on Windows 10 as well? If it's just Windows 7 then I'd be fine with this staying closed, but if it also happens on Windows 10 it'd be good to keep it open given that building with VS is the primary way Windows devs are expected to build Wesnoth.

@Wedge009
Copy link
Member Author

I don't have a build environment on Win10 (only have it in the first place on slow laptops because, well, MS still has a monopoly on pre-built machines) so again I just copied my Win7-built binaries to a Win10 machine. The issue happens there as well, but I as mentioned above, I can't tell if it's an issue specific to the compiler (eg if it was compiled with MSVC on Win10 would it still be a problem?), with boost, or something else entirely.

@Wedge009 Wedge009 reopened this Oct 11, 2021
@Wedge009 Wedge009 changed the title Add-ons server inaccessible on Windows 7 Add-ons server inaccessible with MSVC build Oct 25, 2021
@Wedge009
Copy link
Member Author

Wedge009 commented Nov 9, 2021

@Vultraz I saw you mention that you're already using VS2022 - can you advise if you have any issues accessing the Add-ons server with your builds? If not, it suggests an issue with my boost set-up or something else specific to my Windows 7 environment.

@Wedge009
Copy link
Member Author

Wedge009 commented Dec 8, 2021

Rebuilt with boost 1.78 and SDL 2.0.18 and can access add-ons server again. Odd.

@Wedge009 Wedge009 closed this as completed Dec 8, 2021
@Wedge009
Copy link
Member Author

Wedge009 commented Nov 5, 2022

I forgot about this issue.

Out of curiosity I retested this on both VS2019 on Windows 7 and VS2022 on Windows 10. For whatever reason I've since forgotten, I still choose to compile 1.16 branch via regular VS project, but I adopted the cmake+vcpkg builds for master. The network_asio invalid handle error still occurs in the former while the latter works fine. boost 1.80, SDL 2.24.2 (VS project) and SDL 2.0.22 (cmake).

Leaving this closed because it only occurs in my non-standard VS project build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Add-ons Issues with the add-ons client and/or server. Bug Issues involving unexpected behavior. Building Build-time issues. Network Issues in the networking API. Services Issues involving Wesnoth.org and other project services. Windows OS-specific issues that apply to Microsoft Windows
Projects
None yet
Development

No branches or pull requests

2 participants