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

use undeprecated functions in c-ares #2197

Open
tchaikov opened this issue Apr 17, 2024 · 2 comments
Open

use undeprecated functions in c-ares #2197

tchaikov opened this issue Apr 17, 2024 · 2 comments

Comments

@tchaikov
Copy link
Contributor

c-ares v1.28.1 deprecated a bunch of functions. for instance, ares_gethostbyname() is deprecated in favor of ares_getaddrinfo()

/home/kefu/dev/scylladb/seastar/src/net/dns.cc:265:9: warning: 'ares_gethostbyname' is deprecated: Use ares_getaddrinfo instead [-Wdeprecated-declarations]
  265 |         ares_gethostbyname(_channel, p->name.c_str(), af, [](void* arg, int status, int timeouts, ::hostent* host) {
      |         ^
/usr/include/ares.h:592:14: note: 'ares_gethostbyname' has been explicitly marked deprecated here
  592 | CARES_EXTERN CARES_DEPRECATED_FOR(ares_getaddrinfo) void ares_gethostbyname(
      |              ^
/usr/include/ares.h:145:22: note: expanded from macro 'CARES_DEPRECATED_FOR'
  145 |       __attribute__((deprecated("Use " #f " instead")))
      |                      ^
/home/kefu/dev/scylladb/seastar/src/net/dns.cc:357:22: warning: 'ares_parse_srv_reply' is deprecated: Use ares_dns_parse instead [-Wdeprecated-declarations]
  357 |             status = ares_parse_srv_reply(buf, len, &start);
      |                      ^
@tchaikov
Copy link
Contributor Author

see also c-ares/c-ares@5fd3fc3

@dawmd
Copy link
Contributor

dawmd commented Apr 22, 2024

It's worth noting that among the deprecated functions there is ares_fds, which may crash the system (cf. https://c-ares.org/ares_fds.html#NOTES):

The select(2) call which takes the fd_set parameter has significant limitations which can impact modern systems. The limitations can vary from system to system, but in general if the file descriptor value itself is greater than 1024 (not the count but the actual value), this can lead to ares_fds writing out of bounds which will cause a system crash. In modern networking clients, it is not unusual to have file descriptor values above 1024, especially when a library is pulled in as a dependency into a larger project.

c-ares does not attempt to detect this condition to prevent crashes due to both implementation-defined behavior in the OS as well as integrator-controllable tunables which may impact the limits.

dawmd added a commit to dawmd/seastar that referenced this issue Apr 22, 2024
In v1.28.1, C-Ares marked some of their functions
as deprecated causing compilation errors in
Seastar. This commit makes the compiler ignore
the used functions until we fix it properly
by using recommended (undeprecated) library
functions.

Refs scylladb#2197
tchaikov added a commit to tchaikov/seastar that referenced this issue Apr 23, 2024
c-ares marked some APIs deprecated in 1.28.1.

in this change, we conditionally use the undeprecated APIs when
they are available. please note, we don't specify the minimal
supported c-ares version in our building system.

in which, ares_fds() and ares_process() are not changed yet, because
we need to change the way how to poll the events for name resolution.
this would need more thoughts before moving forward.

Refs scylladb#2197
Signed-off-by: Kefu Chai <[email protected]>
tchaikov added a commit to tchaikov/seastar that referenced this issue Apr 23, 2024
c-ares marked some APIs deprecated in 1.28.1.

in this change, we conditionally use the undeprecated APIs when
they are available. please note, we don't specify the minimal
supported c-ares version in our building system.

in which, ares_fds() and ares_process() are not changed yet, because
we need to change the way how to poll the events for name resolution.
this would need more thoughts before moving forward.

Refs scylladb#2197
Signed-off-by: Kefu Chai <[email protected]>
tchaikov added a commit to tchaikov/seastar that referenced this issue Apr 23, 2024
c-ares marked some APIs deprecated in 1.28.1.

in this change, we conditionally use the undeprecated APIs when
they are available. please note, we don't specify the minimal
supported c-ares version in our building system.

in which, ares_fds() and ares_process() are not changed yet, because
we need to change the way how to poll the events for name resolution.
this would need more thoughts before moving forward.

Refs scylladb#2197
Signed-off-by: Kefu Chai <[email protected]>
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

No branches or pull requests

2 participants