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

The plugin repository could not be contacted on Windows - select_stream problem #3474

Closed
gerardnico opened this issue Apr 12, 2021 · 18 comments

Comments

@gerardnico
Copy link
Contributor

If you have installed Dokuwiki on Windows.

You will get the following message:

The plugin repository could not be contacted. Make sure your server is allowed to contact www.dokuwiki.org and check your proxy settings.

Why ?
Because the HTTP Client makes use of the function select_stream to check a timeout as we can seen here

// wait for stream ready or timeout (1sec)
if (@stream_select($sel_r, $sel_w, $sel_e, 1) === false) {
	usleep(1000);
	continue;
}

The problem is that the function select_stream returns always false as stated in the documentation:

Note: Windows compatibility
Use of stream_select() on file descriptors returned by proc_open() will fail and return false under Windows.

The timeout kick-in and we get the faulty error message.

Solution:

  • On Windows, don't use this.
  • I have deleted all 3 stream_select timeout block and it works like a charm
@gerardnico
Copy link
Contributor Author

Just discovered that there is a isWindows function that may help

@splitbrain
Copy link
Collaborator

We're not using stream_select on a proc_open stream but on a network stream. I manage many Windows setups during my day job and the HTTP client works fine - so it's not a general Windows problem. Simply removing this code is not a proper solution and likely will cause broken downloads occasionally.

The first step would be to provide additional data to find out what goes wrong on your system.

@gerardnico
Copy link
Contributor Author

You lost me with proc_open. I didn't knew that it was a php thing.

I got the following warning from the select_stream call:

stream_select(): unable to select [2]: No such file or directory (max_fd=508)

It seems that max_fd is an acronym for max file descriptor then I thought that the number of open file was reached and that the select_stream was checking the number of open file and returning false because it couldn't get one.

I have tried with Php:

  • php-5.6.9-Win32-VC11-x64
  • php-5.6.9-nts-Win32-VC11-x64

And the select_stream function returns always false

Thanks

@gerardnico
Copy link
Contributor Author

Windows version 10 (20H2 - OS Build 19042.867), it's a dev laptop.

This code works without any problem.

$filename = "http://www.dokuwiki.org/lib/plugins/pluginrepo/api.php?q=dw2pdf&fmt=yaml";
$handle = fopen($filename, "rb");
$http = stream_get_contents($handle);
fclose($handle);
var_dump($http);

@gerardnico
Copy link
Contributor Author

This code does not work if I let the select_stream loop. I got a Timeout while reading headers (15.009s) error.

$http = new \dokuwiki\HTTP\DokuHTTPClient();
$http->debug = 1;
$http->get('http://www.dokuwiki.org/lib/plugins/pluginrepo/api.php?q=sqlite&fmt=yaml');
var_dump($http);

@splitbrain
Copy link
Collaborator

Can you reproduce the problem on a more modern PHP (eg. 7.4)?

@gerardnico
Copy link
Contributor Author

Yeah. It works in 7.4.6.
I have no idea why.
I have installed 5.6 because this is the lowest supported php of Dokuwiki.

@gerardnico
Copy link
Contributor Author

7.2.28 works also.

@gerardnico
Copy link
Contributor Author

I don't have any other locally php version to test.

@phy25
Copy link
Collaborator

phy25 commented Apr 14, 2021

We have already removed all unit tests for PHP 5.6: https://github.com/splitbrain/dokuwiki/blob/4ee6ddae660f9ec72c1f6e2ddb72d6b29d6d8900/.github/workflows/testLinux.yml#L13

Should we make it official that PHP 5.6 is no longer supported?

@splitbrain
Copy link
Collaborator

@phy25 it's already official: 3f874cb only the current stable still supports 5.6

@gerardnico I will close this as won't fix for above reason

@gerardnico
Copy link
Contributor Author

@splitbrain I'm on the stable.

This code is also on the stable.
https://github.com/splitbrain/dokuwiki/blob/stable/inc/HTTP/HTTPClient.php#L589

I have got to the official documentation before installing:
https://www.dokuwiki.org/requirements
And it states that 5.6 is supported.

I would understand that you would not fix this but it should be stated at minimum somewhere
that 5.6. is no more supported.

@splitbrain
Copy link
Collaborator

@gerardnico current stable runs fine on 5.6 (though I would not recommend it) and as far as I know you're the only one having this problem. Even if we would develop a fix or workaround for the problem, it would only be released with the next DokuWiki version. But since this new version will not support 5.6 anymore it would be futile to implement a fix for something that can not be reproduced on newer php versions.

@gerardnico
Copy link
Contributor Author

@splitbrain Yeah I got that. I should have been more specific over what I wanted.

I have updated already the requirement documentation

Php 5.6 will not be supported in the next release and has some [[github>splitbrain/dokuwiki/issues/3474|quirk on Windows]], we recommend to use at minimal from now on the version 7.2.

This is just that we lost already too much time on it and I don't want anybody to get into the same problem (prevention).

If you are ok with this change, I will let it otherwise I can change it.

@mckaygerhard
Copy link

this is windosh*t only problem.. most production servers are unix type anyway so i dont think limit php to 7 is solution.. development tools also stills supports 5.6 so there's no sense in limiting

@gerardnico
Copy link
Contributor Author

gerardnico commented Jun 2, 2021

i dont think limit php to 7 is solution..

@mckaygerhard This is not limiting, this is just seen as not worse to do because the next Dokuwiki release will not support the version 5.6 anymore. If you get the problem, change the code manually or upgrade to a most recent version.

@mckaygerhard
Copy link

mckaygerhard commented Jun 2, 2021

i dont think limit php to 7 is solution..

@mckaygerhard This is not limiting, this is just seen as not worse to do because the next Dokuwiki release will not support the version 5.6 anymore. If you get the problem, change the code manually or upgrade to a most recent version.

maybe the only reference in wiki are made by you about supporting 5.6.. and is a windo only related problem, why si not you that the changed the code event ask to support windo

@gerardnico
Copy link
Contributor Author

@mckaygerhard Sorry but I didn't get what you want. Did you get this problem ? Can i help you ?

Note: The php version 5.6 is also end of life since 31 Dec 2018 which means that most of the installations should have been upgraded.

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

4 participants