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

Invalid argument at /lib/LANraragi/Model/Upload.pm line 158. #626

Closed
anonVin79513 opened this issue May 4, 2022 · 9 comments
Closed

Invalid argument at /lib/LANraragi/Model/Upload.pm line 158. #626

anonVin79513 opened this issue May 4, 2022 · 9 comments
Labels

Comments

@anonVin79513
Copy link

anonVin79513 commented May 4, 2022

LRR Version and OS
Windows, Lanraragi v0.8.5

Bug Details
When inserting multiple Download URLs to request from the downloader, some of the downloads fail. The download does not fail if i spam the request to the server. I fail to consistently reproduce the issue.

This is the line that says there is an invalid argument

Not sure if this would be the issue, but i am using my own downloader plugin, here is the sub if it helps.
sub provide_url {
shift;
my $lrr_info = shift;
my $url = $lrr_info->{url};
my $ua = $lrr_info->{user_agent};
my $res = $ua->max_redirects(5)->get($url)->result->dom;
my $dl = $res->at('a[href$="/download"]')->attr('href');
return ( download_url => $dl);
}

Matching Logs
[Minion] [info] Done!
Mojo::Reactor::Poll: I/O watcher failed: Can't call method "emit" on an undefined value at /usr/local/share/perl5/site_perl/Mojo/Redis.pm line 60.
Mojo::Reactor::Poll: I/O watcher failed: Can't call method "emit" on an undefined value at /usr/local/share/perl5/site_perl/Mojo/Redis.pm line 60.
[Minion] [info] Warming up search cache...
[2022-05-04 14:14:54.20800] [53] [info] Creating process id file "/home/koyomi/lanraragi/public/temp/server.pid"
[2022-05-04 14:14:54.22888] [53] [info] Creating process id file "/home/koyomi/lanraragi/public/temp/server.pid"
[2022-05-04 14:14:55.23040] [53] [info] Creating process id file "/home/koyomi/lanraragi/public/temp/server.pid"
[2022-05-04 14:14:56.23182] [53] [info] Creating process id file "/home/koyomi/lanraragi/public/temp/server.pid"
[Minion] [info] Done!
[Minion] [info] Downloading url https://archive/294...
[Minion] [info] Found downloader koushoku
[Plugin System] [info] No login plugin specified, returning empty UserAgent.
[Minion] [info] URL transformed by plugin to https://archive/294/magical-lab/download
[File Upload/Download] [info] Downloading URL https://archive/294/magical-lab/download...This will take some time.
[Minion] [info] URL downloaded to /tmp/oA9FnuHjhc/[Kamiya Zuzu].zip
[Auto-Plugin] [info] Executing enabled metadata plugins on archive with id 084183efb7f856afa3e52e6390a8433b0b3446d2.
Mojo::Reactor::Poll: I/O watcher failed: Can't call method "emit" on an undefined value at /usr/local/share/perl5/site_perl/Mojo/Redis.pm line 60.
Mojo::Reactor::Poll: I/O watcher failed: Can't call method "emit" on an undefined value at /usr/local/share/perl5/site_perl/Mojo/Redis.pm line 60.
[Minion] [info] Warming up search cache...
[2022-05-04 14:15:36.23268] [53] [info] Creating process id file "/home/koyomi/lanraragi/public/temp/server.pid"
[2022-05-04 14:15:37.23414] [53] [info] Creating process id file "/home/koyomi/lanraragi/public/temp/server.pid"
[Minion] [info] Done!

@Difegue
Copy link
Owner

Difegue commented May 4, 2022

There's been some issues with Windows + 0.8.5 due to underlying changes, notably inconsistent results with network requests -- If you're using WSL1, can you try switching to WSL2 and see if that improves the issue?

I'm not seeing anything wrong in that custom downloader plugin at a glance. 👍

@anonVin79513
Copy link
Author

Sadly I cannot upgrade to WSL2 Since that would disable the usage of VMs that i currently use.

@Difegue
Copy link
Owner

Difegue commented May 4, 2022

I understand; Does the issue happen on 0.8.4 as well, then?

@anonVin79513
Copy link
Author

Interesting. Whatever Changed between 0.8.4 and 0.8.5 broke the downloader. I was able to download a batch of 100 without having any issues on 0.8.4 but on 0.8.5 i can barley download 5 downloads before i get the errors described above. Thank for downgrade tip. Just started using LANraragi. Note both were still ran on WSL1 as i do not have a way to test WSL2.

@Difegue
Copy link
Owner

Difegue commented May 5, 2022

Yeah I'm guessing this is the same issue as #619 / #621 / #622 .
0.8.5 switched from Alpine Linux 3.12 to 3.14 as a base, which can break DNS lookups for websites which do not provide a AAAA ipv6 record: See https://gitlab.alpinelinux.org/alpine/aports/-/issues/11879 , home-assistant/core#57173 or docker/for-mac#5088 .

I might try and introduce a dedicated DNS lib to mitigate this issue, (cf. https://christoph.luppri.ch/fixing-dns-resolution-for-ruby-on-alpine-linux ) but in the meantime users can either downgrade or use WSL2.

@Difegue
Copy link
Owner

Difegue commented May 12, 2022

I've switched to a different DNS library that's easily usable from Mojolicious, but considering it's still using syscalls for DNS I doubt it'll fix the issue 🤔

You might want to try installing a nightly now and see if it improves things.

@anonVin79513
Copy link
Author

Nope. It did not make things any better. If anything I think more downloads in a batch are failing now.

@Difegue Difegue pinned this issue May 26, 2022
@Difegue Difegue added the bug label May 26, 2022
@Difegue
Copy link
Owner

Difegue commented May 26, 2022

I've had reports that the Net::DNS::Native switch does improve things for the few Linux hosts also encountering this problem, so that's probably going to stay in for now.

As for Windows+WSL1, I'm still investigating potential solutions: One of them seems to be disabling IPv6 on the Windows host.
You might also find success by changing your Windows DNS to 8.8.8.8 or 1.1.1.1.

Past that, it's unlikely WSL1 will receive updates by Microsoft to fix the issue, so I'll have to either:

  • Build legacy images on alpine 3.12 and use those in Windows builds -- This needs some extra CI/workflow changes and feels like a bandaid tbh
  • Use custom DNS resolving in the entire app -- There's no easy custom DNS resolver for mojolicious so that's probably the most expensive solution
  • Kind of a derivative of the previous idea, add dnsmask to the Docker image to act as an intermediary working DNS
  • Go all in on WSL2 by notably fixing its biggest flaw through Investigate bundling WSLHostPatcher in the Windows version #580 -- This is the easiest and fixes an existing problem as well, but doesn't fix the issue for users that are stuck on WSL1.

@Difegue
Copy link
Owner

Difegue commented Jun 16, 2022

I went for the bandaid in the end :^)

Other options are too much of a pain and I can't decently drop WSL1 yet since v2 doesn't cover all bases even with the hostpatcher.

Windows nightlies now use alpine 3.12 again -- There's no change to the regular Docker images but you can build a 3.12 image if you want by using Dockerfile-legacy in /tools.

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

2 participants