-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Bug in DnsPinMiddleware.php, unable to resolve hostname #27870
Comments
Are you sure? I don't see that we modify $target in the above code. |
server/lib/private/Http/Client/DnsPinMiddleware.php Lines 83 to 85 in c2f62ee
dns_get_record may return false (if for whatever reason resolving the dns record is not possible). In the above code a check if $dnsResponses is false is missing. count(false) will raise a "must be of type Countable|array," warning because false is not countable. But there is still something different broken as resolving a dns record failed. #27873 is the same error also for FreeBSD. I remember some issues with OpenSSL due some security hardening on FreeBSD. Is it possible that resolving dns records is forbidden on your setup (for php applications). To test if getting dns records work in general with: |
@kesselb Your command executes just fine. Infact that's how I manage to finish the upgrade, I've changed and it worked
Quite, I added a print statement in the code. |
Would you mind to do another test round? ;) |
@kesselb Sure!
|
Same here on FreeBSD 12.2. with NC 22.0 - Problem is "CNAME" php -r "var_dump(dns_get_record('apps.nextcloud.com', DNS_A));" |
Same problem. Quick workaround:
|
`dns_get_record` can return false which results in exceptions such as the ones shown in #27870. Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Adding a non-false check here makes sense. Please check #27922 |
`dns_get_record` can return false which results in exceptions such as the ones shown in #27870. Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Thank you for this! I've been pulling what little hair I have left out for the last 3 days trying to get my Docker container to function again. |
TrueNAS 12 - U4 (FreeBSD 12)
Running php -r "var_dump(dns_get_record('apps.nextcloud.com', DNS_A));" I get
|
I'm still getting errors in my logs when trying to open the dashboard: I don't get the background image, and the following (partial) log:
I had hand-edited my if ($dnsResponses !== false && count($dnsResponses) > 0) {
foreach ($dnsResponses as $key => $dnsResponse) {
... |
Please file a new bug and provide all necessary details. We sadly lack a 🔮 |
Allowed my upgrade to complete. THANK YOU! |
I'm going to risk exposing myself as an idiot in the spirit of trying to help others. If you still seem to be struggling with your server claiming it has no internet connection after this was fixed in version 21.1.0 and you're running systemd-resolved on Arch Linux, make sure your /etc/resolv.conf isn't empty. It should probably be linked to /run/systemd/resolve/stub-resolv.conf per https://wiki.archlinux.org/title/Systemd-resolved#DNS 🤦♂️️ |
A friend asked me to look at his Nextcloud server because it didn't want to update to 23. It had a absolutely insane amount of errors about Now 23.0.0 seems to run fine, except that the constant flood of error messages is back. So we again changed This band aid is fine for now, but does anyone have any suggestions how to fix this in a more robust and future proof way? |
Steps to reproduce
I'm running Nextcloud 22 on freebsd PHP8 , just upgraded from 21, and it failed
Checking for update of app activity in appstore
An unhandled exception has been thrown:
TypeError: count(): Argument #1 ($value) must be of type Countable|array, bool given in /usr/local/www/owncloud/lib/private/Http/Client/DnsPinMiddleware.php:68
Stack trace:
#0 /usr/local/www/owncloud/lib/private/Http/Client/DnsPinMiddleware.php(68): count()
#1 /usr/local/www/owncloud/lib/private/Http/Client/DnsPinMiddleware.php(111): OC\Http\Client\DnsPinMiddleware->dnsResolve()
#2 /usr/local/www/owncloud/3rdparty/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php(35): OC\Http\Client\DnsPinMiddleware->OC\Http\Client{closure}()
#3 /usr/local/www/owncloud/3rdparty/guzzlehttp/guzzle/src/Middleware.php(31): GuzzleHttp\PrepareBodyMiddleware->__invoke()
#4 /usr/local/www/owncloud/3rdparty/guzzlehttp/guzzle/src/RedirectMiddleware.php(71): GuzzleHttp\Middleware::GuzzleHttp{closure}()
#5 /usr/local/www/owncloud/3rdparty/guzzlehttp/guzzle/src/Middleware.php(63): GuzzleHttp\RedirectMiddleware->__invoke()
#6 /usr/local/www/owncloud/3rdparty/guzzlehttp/guzzle/src/HandlerStack.php(75): GuzzleHttp\Middleware::GuzzleHttp{closure}()
#7 /usr/local/www/owncloud/3rdparty/guzzlehttp/guzzle/src/Client.php(331): GuzzleHttp\HandlerStack->__invoke()
#8 /usr/local/www/owncloud/3rdparty/guzzlehttp/guzzle/src/Client.php(168): GuzzleHttp\Client->transfer()
#9 /usr/local/www/owncloud/3rdparty/guzzlehttp/guzzle/src/Client.php(187): GuzzleHttp\Client->requestAsync()
#10 /usr/local/www/owncloud/lib/private/Http/Client/Client.php(223): GuzzleHttp\Client->request()
#11 /usr/local/www/owncloud/lib/private/App/AppStore/Fetcher/Fetcher.php(108): OC\Http\Client\Client->get()
#12 /usr/local/www/owncloud/lib/private/App/AppStore/Fetcher/AppFetcher.php(79): OC\App\AppStore\Fetcher\Fetcher->fetch()
#13 /usr/local/www/owncloud/lib/private/App/AppStore/Fetcher/Fetcher.php(180): OC\App\AppStore\Fetcher\AppFetcher->fetch()
#14 /usr/local/www/owncloud/lib/private/Installer.php(434): OC\App\AppStore\Fetcher\Fetcher->get()
#15 /usr/local/www/owncloud/lib/private/Updater.php(420): OC\Installer->isUpdateAvailable()
#16 /usr/local/www/owncloud/lib/private/Updater.php(268): OC\Updater->upgradeAppStoreApps()
#17 /usr/local/www/owncloud/lib/private/Updater.php(130): OC\Updater->doUpgrade()
#18 /usr/local/www/owncloud/core/Command/Upgrade.php(241): OC\Updater->upgrade()
#19 /usr/local/www/owncloud/3rdparty/symfony/console/Command/Command.php(255): OC\Core\Command\Upgrade->execute()
#20 /usr/local/www/owncloud/3rdparty/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run()
#21 /usr/local/www/owncloud/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()
#22 /usr/local/www/owncloud/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()
#23 /usr/local/www/owncloud/lib/private/Console/Application.php(209): Symfony\Component\Console\Application->run()
#24 /usr/local/www/owncloud/console.php(99): OC\Console\Application->run()
#25 /usr/local/www/owncloud/occ(11): require_once('/usr/local/www/...')
Turns out the issue is in DnsPinMiddleware.php.
Basically there
$dnsTypes = [DNS_A, DNS_AAAA, DNS_CNAME];
foreach ($dnsTypes as $key => $dnsType) {
if ($this->negativeDnsCache->isNegativeCached($target, $dnsType)) {
unset($dnsTypes[$key]);
continue;
}
assuming the $target is apps.nextcloud.com after that part of the code the $target will be apps.nextcloud.comapps.nextcloud.comapps.nextcloud.com which will make the dns resolver to fail.
Sorry for the short report but I am running out of time.
The text was updated successfully, but these errors were encountered: