grpc / grpc/grpc

Deprecated C-ares ares_gethostbyname crashing on DNS lookup on newer windows versions

Open
#39,055 1 comment 0 reactions 1 assignee Claimed by @murgatroid99 View on GitHub
kind/bug lang/c++ priority/P2
Dominant language
C++
Stars
45.3k
Forks
11.4k
Avg merge
2d 12h
Merged PRs (30d)
47

Description

### What version of gRPC and what language are you using?
grpc1.68.0

### What operating system (Linux, Windows,...) and version?
Crashing on this machine only: Windows 11 Pro Education (OS Build 26100.3323)

No crashes on below machines:
Compiler machine version: Windows 11 Pro N for Workstations (OS Build 22631.5039)
Windows 10 machines (tested on 15+ machines works flawlessly)

### What runtime / compiler are you using (e.g. python version or version of gcc)
Microsoft (R) C/C++ Optimizing Compiler Version 19.42.34435 for x64

### What did you do?
Compiled grpc-1.68.0 & linked with my program, it(grpc) sends DNS requests to get the target RPC servers address before initiating the http2 connection. On the above machines as mentioned crash is observed on newer builds of windows 11 while no crashes are observed on older builds of windows 11.

gRPC's event engine uses this https://github.com/grpc/grpc/blob/6adf614949b8dcf7deefc665cf1dd335ebf0b05f/src/core/lib/event_engine/ares_resolver.cc#L329
which is deprecated in the corresponding c-ares version as follows
https://github.com/c-ares/c-ares/blob/7978cf75a82f9860da241227169a4d7f1d1f549a/include/ares.h#L879

surprisingly microsoft has also marked a similar function deprecated for newer builds of windows 11 https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-gethostbyname

### What did you expect to see?

### What did you see instead?

![Image](https://github.com/user-attachments/assets/f37c1906-f660-402e-92c9-5f372b370410)

The above crash is observed only on the mentioned crashing machine above
for older machines it works

### Anything else we should know about your project / environment?
Compiled on VM tested on bare metal

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.