diff --git a/Makefile b/Makefile index 6a62a690816..fb02702cc05 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,7 @@ TRACER_SOURCES_INI := -d datadog.trace.sources_path=$(TRACER_SOURCE_DIR) RUN_TESTS_IS_PARALLEL ?= $(shell test $(PHP_MAJOR_MINOR) -ge 74 && echo 1) # shuffle parallel tests to evenly distribute test load, avoiding a batch of 32 tests being request-replayer tests -RUN_TESTS_CMD := DD_SERVICE= DD_ENV= REPORT_EXIT_STATUS=1 TEST_PHP_SRCDIR=$(PROJECT_ROOT) USE_TRACKED_ALLOC=1 php -n -d 'memory_limit=-1' $(BUILD_DIR)/run-tests.php $(if $(QUIET_TESTS),,-g FAIL,XFAIL,BORK,WARN,LEAK,XLEAK,SKIP) $(if $(ASAN), --asan) --show-diff -n -p $(shell which php) -q $(if $(RUN_TESTS_IS_PARALLEL), --shuffle -j$(MAX_TEST_PARALLELISM)) +RUN_TESTS_CMD := DD_SERVICE= DD_ENV= DD_TRACE_RETRY_INTERVAL=1 REPORT_EXIT_STATUS=1 TEST_PHP_SRCDIR=$(PROJECT_ROOT) USE_TRACKED_ALLOC=1 php -n -d 'memory_limit=-1' $(BUILD_DIR)/run-tests.php $(if $(QUIET_TESTS),,-g FAIL,XFAIL,BORK,WARN,LEAK,XLEAK,SKIP) $(if $(ASAN), --asan) --show-diff -n -p $(shell which php) -q $(if $(RUN_TESTS_IS_PARALLEL), --shuffle -j$(MAX_TEST_PARALLELISM)) C_FILES = $(shell find components components-rs ext src/dogstatsd tracer zend_abstract_interface -name '*.c' -o -name '*.h' | awk '{ printf "$(BUILD_DIR)/%s\n", $$1 }' ) TEST_FILES = $(shell find tests/ext -name '*.php*' -o -name '*.inc' -o -name '*.json' -o -name '*.yaml' -o -name 'CONFLICTS' | awk '{ printf "$(BUILD_DIR)/%s\n", $$1 }' ) diff --git a/components-rs/crashtracker.h b/components-rs/crashtracker.h index 65ab3af974b..5d366a1ce1f 100644 --- a/components-rs/crashtracker.h +++ b/components-rs/crashtracker.h @@ -170,6 +170,25 @@ struct ddog_VoidResult ddog_crasht_report_unhandled_exception(ddog_CharSlice err ddog_CharSlice error_message, struct ddog_crasht_Handle_StackTrace *runtime_stack); +/** + * Register the expected PID of the socket-based crash receiver + * + * When `collect_all_threads` is enabled and the receiver is reached via a Unix + * socket, the crash handler will only grant ptrace permission if the socket + * peer's PID matches this registered value. + * + * Call this after establishing a trusted connection to the sidecar + * + * # Safety + * This function is safe to call from any thread at any time. + */ +void ddog_crasht_set_expected_receiver_pid(int32_t pid); + +/** + * Returns the currently registered expected receiver PID, or 0 if unset. + */ +int32_t ddog_crasht_get_expected_receiver_pid(void); + /** * Removes all existing additional tags * Expected to be used after a fork, to reset the additional tags on the child diff --git a/components-rs/sidecar.h b/components-rs/sidecar.h index eb0b5be0580..27edede5e97 100644 --- a/components-rs/sidecar.h +++ b/components-rs/sidecar.h @@ -200,6 +200,7 @@ ddog_MaybeError ddog_sidecar_session_set_config(struct ddog_SidecarTransport **t ddog_CharSlice language_version, ddog_CharSlice tracer_version, uint32_t flush_interval_milliseconds, + uint32_t retry_interval_milliseconds, uint32_t remote_config_poll_interval_millis, uint32_t telemetry_heartbeat_interval_millis, uint64_t telemetry_extended_heartbeat_interval_millis, diff --git a/ext/configuration.h b/ext/configuration.h index d6402649dcb..f3d1b811db9 100644 --- a/ext/configuration.h +++ b/ext/configuration.h @@ -107,6 +107,7 @@ enum datadog_sidecar_connection_mode { CONFIG(BOOL, DD_INJECT_FORCE, "false", .ini_change = zai_config_system_ini_change) \ CONFIG(DOUBLE, DD_REMOTE_CONFIG_POLL_INTERVAL_SECONDS, "5.0", .ini_change = zai_config_system_ini_change) \ CONFIG(BOOL, DD_REMOTE_CONFIG_ENABLED, "true", .ini_change = zai_config_system_ini_change) \ + CONFIG(INT, DD_TRACE_RETRY_INTERVAL, "100", .ini_change = zai_config_system_ini_change) \ CONFIG(BOOL, DD_EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED, "true") #define DD_CONFIGURATIONS_ONLY diff --git a/ext/sidecar.c b/ext/sidecar.c index 860db78e9db..a151d6fa2d6 100644 --- a/ext/sidecar.c +++ b/ext/sidecar.c @@ -110,6 +110,7 @@ static void dd_sidecar_post_connect(ddog_SidecarTransport **transport, bool is_f php_version_rt, DDOG_CHARSLICE_C(PHP_DDTRACE_VERSION), get_global_DD_TRACE_AGENT_FLUSH_INTERVAL(), + get_global_DD_TRACE_RETRY_INTERVAL(), (int)(get_global_DD_REMOTE_CONFIG_POLL_INTERVAL_SECONDS() * 1000), // for historical reasons in seconds get_global_DD_TELEMETRY_HEARTBEAT_INTERVAL() * 1000, diff --git a/libdatadog b/libdatadog index 6760faaeeda..d2b505bbd94 160000 --- a/libdatadog +++ b/libdatadog @@ -1 +1 @@ -Subproject commit 6760faaeeda1cfcf634410105f93cf7149265592 +Subproject commit d2b505bbd94b24e9919411ef6212b729685fe6d8 diff --git a/metadata/supported-configurations.json b/metadata/supported-configurations.json index f5f379f0988..1cf6ad217ff 100644 --- a/metadata/supported-configurations.json +++ b/metadata/supported-configurations.json @@ -2168,6 +2168,13 @@ "default": "false" } ], + "DD_TRACE_RETRY_INTERVAL": [ + { + "implementation": "B", + "type": "int", + "default": "100" + } + ], "DD_TRACE_ROADRUNNER_ANALYTICS_ENABLED": [ { "implementation": "A", diff --git a/tests/ext/telemetry/config.phpt b/tests/ext/telemetry/config.phpt index d4f950aff41..fdebcc03fb4 100644 --- a/tests/ext/telemetry/config.phpt +++ b/tests/ext/telemetry/config.phpt @@ -19,6 +19,7 @@ DD_TRACE_AUTOFINISH_SPANS=1 DD_INSTRUMENTATION_TELEMETRY_ENABLED=1 DD_AGENT_HOST= DD_AUTOLOAD_NO_COMPILE= +DD_TRACE_RETRY_INTERVAL= DD_TRACE_GIT_METADATA_ENABLED=0 DD_TRACE_IGNORE_AGENT_SAMPLING_RATES=1 DD_EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED=0