Skip to content

remove feof() check on connection. this check fails under Windows wh… #1177

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

Merged
merged 2 commits into from
May 27, 2024

Conversation

jjdunn
Copy link
Contributor

@jjdunn jjdunn commented May 24, 2024

fix problem connecting to some (but not all) servers under Windows

note: I don't know how to submit a valid test for this PR because I cannot give credentials for the private server where connection fails, due to confidential information

@jjdunn
Copy link
Contributor Author

jjdunn commented May 24, 2024

@ramunasd thanks for the feedback. you are correct of course. please review revised PR.

EDIT: I just realized I don't know how old PHP version PhpAmqpLib is supporting. PHP_OS_FAMILY is since 7.2. Is that new enough? If not I will revert to parsing PHP_OS or php_uname()

@jjdunn
Copy link
Contributor Author

jjdunn commented May 24, 2024

p.s. I am trying to contact syadmin for the RabbitMQ server I'm unable to connect to with the master-branch code, to see if there is any useful info in the logs. If so I will post it here.

Also - is there any publicly-accessible RabbitMQ server on Linux host which I can test against?

@ramunasd ramunasd merged commit 86d669c into php-amqplib:master May 27, 2024
9 checks passed
@jjdunn jjdunn deleted the fix-FEOF-windows-cannot-connect branch May 27, 2024 19:23
@jjdunn
Copy link
Contributor Author

jjdunn commented May 28, 2024

p.s. I am trying to contact syadmin for the RabbitMQ server I'm unable to connect to with the master-branch code, to see if there is any useful info in the logs. If so I will post it here.

the sysadmin for this RabbitMQ server sent me some log excerpts. I can't match the IP address (seems to be private) but the timing matches when I was trying to connect, with the original PhpAmqpLib code:

message-broker log excerpt:

sli_mq.1.fcgp1yqbgqbj@node1-hz    | 2024-05-23 20:29:47.724 [info] <0.22136.105> accepting AMQP connection <0.22136.105> (10.0.19.14:42878 -> 10.0.19.13:5672)
sli_mq.1.fcgp1yqbgqbj@node1-hz    | 2024-05-23 20:29:47.724 [error] <0.22136.105> closing AMQP connection <0.22136.105> (10.0.19.14:42878 -> 10.0.19.13:5672):
sli_mq.1.fcgp1yqbgqbj@node1-hz    | {handshake_timeout,handshake}

load-balancer log excerpt:

time="2024-05-23T20:29:44Z" level=debug msg="Filtering disabled container" providerName=docker container=sli-whoami-it2c963pidnt7yunl1n5gdnvq
time="2024-05-23T20:29:44Z" level=debug msg="Filtering disabled container" providerName=docker container=sli-traefik-sd1ucm69c1k67ox316uoux7gq
time="2024-05-23T20:29:44Z" level=debug msg="Filtering disabled container" providerName=docker container=sli-postgres-ea31szy738abct3udh3dm2g5u
time="2024-05-23T20:29:44Z" level=debug msg="Configuration received from provider docker: {"http":{"routers":{"mq":{"entryPoints":["websecure"],"service":"mq","rule":"Host(`mq.dhamma.org.au`)","tls":{"certResolver":"mytlschallenge"}},"nginx-service":{"entryPoints":["websecure"],"service":"nginx-service","rule":"Host(`sli-api-doc.dhamma.org.au`)","tls":{"certResolver":"mytlschallenge"}},"simplerisk":{"entryPoints":["websecure"],"service":"simplerisk-service","rule":"Host(`simplerisk.swarm.dhamma.org.au`)","tls":{"certResolver":"mytlschallenge"}},"sli":{"entryPoints":["websecure"],"service":"sli-service","rule":"Host(`sli.dhamma.org.au`)","tls":{"certResolver":"mytlschallenge"}},"testsli":{"entryPoints":["websecure"],"service":"testsli-service","rule":"Host(`staging-sli.dhamma.org.au`)","tls":{"certResolver":"mytlschallenge"}}},"services":{"mq":{"loadBalancer":{"servers":[{"url":"http://10.0.19.13:15672"}],"passHostHeader":true}},"nginx-service":{"loadBalancer":{"servers":[{"url":"http://10.0.19.11:80"}],"passHostHeader":true}},"simplerisk-service":{"loadBalancer":{"servers":[{"url":"http://10.0.19.3:80"}],"passHostHeader":true}},"sli-service":{"loadBalancer":{"servers":[{"url":"http://10.0.19.9:3011"}],"passHostHeader":true}},"testsli-service":{"loadBalancer":{"servers":[{"url":"http://10.0.19.12:3011"}],"passHostHeader":true}}},"middlewares":{"simpleriskHeader":{"headers":{"stsSeconds":15552000,"stsIncludeSubdomains":true,"stsPreload":true,"forceSTSHeader":true,"contentSecurityPolicy":"\\"upgrade-insecure-requests\\""}}}},"tcp":{"routers":{"mq-connect":{"entryPoints":["rabbitmq"],"service":"mq-connect","rule":"HostSNI(`mq-connect.dhamma.org.au`)","tls":{"passthrough":false,"certResolver":"mytlschallenge"}}},"services":{"mq-connect":{"loadBalancer":{"terminationDelay":100,"servers":[{"address":"10.0.19.13:5672"}]}}}},"udp":{}}" providerName=docker
time="2024-05-23T20:29:44Z" level=info msg="Skipping same configuration" providerName=docker
time="2024-05-23T20:29:47Z" level=error msg="Error during connection: read tcp 10.0.19.14:42878->10.0.19.13:5672: read: connection reset by peer"
time="2024-05-23T20:29:47Z" level=debug msg="Error while terminating connection: close tcp 10.0.19.14:42878->10.0.19.13:5672: shutdown: transport endpoint is not connected"

knowing very little about Rabbit MQ I can't tell if this information is useful; but perhaps someone will find a clue...

if I'm reading it right, "connection reset by peer" seems to indicate the PhpAmqpLib code terminated the connection before it was established.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants