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

Auto PR from release/0.7 to main #330

Merged
merged 5 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/ci.linux.x86.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ jobs:

container:
image: dokken/centos-stream-8:sha-40294ce
# In order to run io_uring, the docker daemon should add --default-ulimit memlock=-1:-1
options: --cpus 4

steps:
Expand Down Expand Up @@ -116,6 +115,5 @@ jobs:
- name: Test
run: |
cd build
ulimit -l unlimited
export PHOTON_CI_EV_ENGINE=io_uring
ctest --timeout 3600 -V
2 changes: 1 addition & 1 deletion CMake/Findgflags.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
find_path(GFLAGS_INCLUDE_DIRS gflags/gflags.h)

find_library(GFLAGS_LIBRARIES gflags_nothreads)
find_library(GFLAGS_LIBRARIES gflags)

find_package_handle_standard_args(gflags DEFAULT_MSG GFLAGS_LIBRARIES GFLAGS_INCLUDE_DIRS)

Expand Down
4 changes: 0 additions & 4 deletions CMake/Findgoogletest.cmake
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
find_path(GOOGLETEST_INCLUDE_DIRS gtest/gtest.h gmock/gmock.h)

find_library(GOOGLETEST_GTEST_LIBRARIES gtest)
find_library(GOOGLETEST_GTEST_MAIN_LIBRARIES gtest_main)
find_library(GOOGLETEST_GMOCK_LIBRARIES gmock)
find_library(GOOGLETEST_GMOCK_MAIN_LIBRARIES gmock_main)

set(GOOGLETEST_LIBRARIES
${GOOGLETEST_GTEST_LIBRARIES}
${GOOGLETEST_GTEST_MAIN_LIBRARIES}
${GOOGLETEST_GMOCK_LIBRARIES}
${GOOGLETEST_GMOCK_MAIN_LIBRARIES}
)

find_package_handle_standard_args(googletest DEFAULT_MSG GOOGLETEST_LIBRARIES GOOGLETEST_INCLUDE_DIRS)
Expand Down
12 changes: 8 additions & 4 deletions CMake/build-from-src.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ function(build_from_src [dep])
aio
URL ${PHOTON_AIO_SOURCE}
URL_MD5 605237f35de238dfacc83bcae406d95d
UPDATE_DISCONNECTED ON
BUILD_IN_SOURCE ON
CONFIGURE_COMMAND ""
BUILD_COMMAND $(MAKE) prefix=${BINARY_DIR} install
Expand All @@ -24,6 +25,7 @@ function(build_from_src [dep])
zlib
URL ${PHOTON_ZLIB_SOURCE}
URL_MD5 9b8aa094c4e5765dabf4da391f00d15c
UPDATE_DISCONNECTED ON
BUILD_IN_SOURCE ON
CONFIGURE_COMMAND CFLAGS=-fPIC ./configure --prefix=${BINARY_DIR} --static
BUILD_COMMAND $(MAKE)
Expand All @@ -38,6 +40,7 @@ function(build_from_src [dep])
uring
URL ${PHOTON_URING_SOURCE}
URL_MD5 2e8c3c23795415475654346484f5c4b8
UPDATE_DISCONNECTED ON
BUILD_IN_SOURCE ON
CONFIGURE_COMMAND ./configure --prefix=${BINARY_DIR}
BUILD_COMMAND V=1 CFLAGS=-fPIC $(MAKE) -C src
Expand All @@ -59,7 +62,7 @@ function(build_from_src [dep])
endif ()
ExternalProject_Get_Property(gflags BINARY_DIR)
set(GFLAGS_INCLUDE_DIRS ${BINARY_DIR}/include PARENT_SCOPE)
set(GFLAGS_LIBRARIES ${BINARY_DIR}/lib/libgflags${POSTFIX}.a ${BINARY_DIR}/lib/libgflags_nothreads${POSTFIX}.a PARENT_SCOPE)
set(GFLAGS_LIBRARIES ${BINARY_DIR}/lib/libgflags${POSTFIX}.a PARENT_SCOPE)

elseif (dep STREQUAL "googletest")
ExternalProject_Add(
Expand All @@ -72,19 +75,19 @@ function(build_from_src [dep])
ExternalProject_Get_Property(googletest SOURCE_DIR)
ExternalProject_Get_Property(googletest BINARY_DIR)
set(GOOGLETEST_INCLUDE_DIRS ${SOURCE_DIR}/googletest/include ${SOURCE_DIR}/googlemock/include PARENT_SCOPE)
set(GOOGLETEST_LIBRARIES ${BINARY_DIR}/lib/libgmock.a ${BINARY_DIR}/lib/libgmock_main.a
${BINARY_DIR}/lib/libgtest.a ${BINARY_DIR}/lib/libgtest_main.a PARENT_SCOPE)
set(GOOGLETEST_LIBRARIES ${BINARY_DIR}/lib/libgmock.a ${BINARY_DIR}/lib/libgtest.a PARENT_SCOPE)

elseif (dep STREQUAL "openssl")
set(BINARY_DIR ${PROJECT_BINARY_DIR}/openssl-build)
ExternalProject_Add(
openssl
URL ${PHOTON_OPENSSL_SOURCE}
URL_MD5 bad68bb6bd9908da75e2c8dedc536b29
UPDATE_DISCONNECTED ON
BUILD_IN_SOURCE ON
CONFIGURE_COMMAND ./config -fPIC --prefix=${BINARY_DIR} --openssldir=${BINARY_DIR} shared
BUILD_COMMAND make -j 1 # https://github.com/openssl/openssl/issues/5762#issuecomment-376622684
INSTALL_COMMAND $(MAKE) install
INSTALL_COMMAND make install
LOG_CONFIGURE ON
LOG_BUILD ON
LOG_INSTALL ON
Expand All @@ -102,6 +105,7 @@ function(build_from_src [dep])
curl
URL ${PHOTON_CURL_SOURCE}
URL_MD5 a66270f11e3fbfad709600bbd1686704
UPDATE_DISCONNECTED ON
BUILD_IN_SOURCE ON
CONFIGURE_COMMAND autoreconf -i COMMAND ./configure --with-ssl=${OPENSSL_ROOT_DIR}
--without-libssh2 --enable-static --enable-shared=no --enable-optimize
Expand Down
10 changes: 7 additions & 3 deletions io/iouring-wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,14 @@ class iouringEngine : public MasterEventEngine, public CascadingEventEngine, pub
}

int init() {
rlimit resource_limit{.rlim_cur = RLIM_INFINITY, .rlim_max = RLIM_INFINITY};
if (setrlimit(RLIMIT_MEMLOCK, &resource_limit) != 0) {
LOG_ERROR_RETURN(0, -1, "iouring: failed to set resource limit. Use command `ulimit -l unlimited`, or change to root");
int compare_result;
if (kernel_version_compare("5.11", compare_result) == 0 && compare_result <= 0) {
rlimit resource_limit{.rlim_cur = RLIM_INFINITY, .rlim_max = RLIM_INFINITY};
if (setrlimit(RLIMIT_MEMLOCK, &resource_limit) != 0)
LOG_ERROR_RETURN(0, -1, "iouring: failed to set resource limit. "
"Use command `ulimit -l unlimited`, or change to root");
}

check_register_file_support();
check_cooperative_task_support();
set_submit_wait_function();
Expand Down
4 changes: 2 additions & 2 deletions net/http/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ ISocketStream* PooledDialer::dial(std::string_view host, uint16_t port, bool sec
std::string strhost(host);
auto ipaddr = resolver->resolve(strhost.c_str());
if (ipaddr.undefined()) {
LOG_ERROR_RETURN(0, nullptr, "DNS resolve failed, name = `", host)
LOG_ERROR_RETURN(ENOENT, nullptr, "DNS resolve failed, name = `", host)
}

EndPoint ep(ipaddr, port);
Expand Down Expand Up @@ -165,7 +165,7 @@ class ClientImpl : public Client {
? m_dialer.dial(m_proxy_url, tmo.timeout())
: m_dialer.dial(req, tmo.timeout());
if (!s) {
if (errno == ECONNREFUSED) {
if (errno == ECONNREFUSED || errno == ENOENT) {
LOG_ERROR_RETURN(0, ROUNDTRIP_FAST_RETRY, "connection refused")
}
LOG_ERROR_RETURN(0, ROUNDTRIP_NEED_RETRY, "connection failed");
Expand Down
4 changes: 2 additions & 2 deletions net/kernel_socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1035,8 +1035,8 @@ extern "C" ISocketServer* new_fstack_dpdk_socket_server() {

/* Implementations in socket.h */

EndPoint::EndPoint(const char* s) {
estring_view ep(s);
EndPoint::EndPoint(const char* _ep) {
estring_view ep(_ep);
auto pos = ep.find_last_of(':');
if (pos == estring::npos)
return;
Expand Down
5 changes: 3 additions & 2 deletions net/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ namespace net {
uint16_t port = 0;
EndPoint() = default;
EndPoint(IPAddr ip, uint16_t port) : addr(ip), port(port) {}
explicit EndPoint(const char* s);
explicit EndPoint(const char* ep);
EndPoint(const char* ip, uint16_t port) : addr(ip), port(port) {}
bool is_ipv4() const {
return addr.is_ipv4();
};
Expand All @@ -161,7 +162,7 @@ namespace net {
return !operator==(rhs);
}
bool undefined() const {
return addr.undefined() && port == 0;
return addr.undefined();
}
};

Expand Down
Loading