amphp / byte-stream

A non-blocking stream abstraction for PHP based on Amp.
https://amphp.org/byte-stream
MIT License
364 stars 30 forks source link

Assertion fail: Trying to read from a previously fclose()'d resource (Windows) #79

Open Bilge opened 3 years ago

Bilge commented 3 years ago

When trying to do a simple HTTP request with HttpClient, I invariable receive a DnsException thrown by Amp\Dns\Rfc1035StubResolver:197, which is part of a MultiReasonException containing two such exceptions, whose previous exception is an AssertionError from byte-stream\lib\ResourceInputStream.php:135 where an assertion containing the following message fails:

Trying to read from a previously fclose()'d resource. Do NOT manually fclose() resources the loop still has a reference to.

Libraries

amphp/amp                             v2.5.2
amphp/beanstalk                       v0.3.2
amphp/byte-stream                     v1.8.1
amphp/cache                           v1.4.0
amphp/dns                             v1.2.3
amphp/hpack                           v3.1.0
amphp/http                            v1.6.3
amphp/http-client                     v4.5.5
amphp/http-client-cookies             v1.1.0
amphp/parallel                        v1.4.0
amphp/parser                          v1.0.0
amphp/postgres                        v1.3.3
amphp/process                         v1.1.1
amphp/serialization                   v1.0.0
amphp/socket                          v1.1.3
amphp/sql                             v1.0.1
amphp/sql-common                      v1.1.2
amphp/sync                            v1.4.0
amphp/uri                             v0.1.4
amphp/windows-registry                v0.3.3
Bilge commented 3 years ago

Turns out rebooting Windows "fixed" this, but every time I hibernate and wake from sleep, it fails again. This never used to happen, so I guess a recent Windows 10 update terminally broke this, but again, only after putting the computer to sleep via hibernate.

kelunik commented 3 years ago

@Bilge: Please try running https://github.com/amphp/windows-registry/blob/9be2c13bc44970d89572f9e0746969283dfa355a/examples/dns.php before and after hibernate.

Bilge commented 3 years ago

After hibernation (Amp DNS is broken)

Found nameservers: 192.168.1.1:53

Note: The above appears to be an IP assigned to VirtualBox Host-Only Ethernet Adapter #4.

After reboot (Amp DNS is working)

Found nameservers: 188.172.144.120:53, 141.0.144.64:53

These are nameservers assigned by my ISP to my Wi-Fi adapter.