diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e042fdd82e5fb47704c619597202ebe7058b299..bfc7a75e9855e62932384d4bbfbd0462b26ff425 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +## 21.12.1 (in progress) + +IMPROVEMENTS +* renamed and hid C++ macros from client code + +BUG FIXES +* Producer API: fixed bug segfault in Python code when sending data object which memory is from some other object + + ## 21.12.0 FEATURES diff --git a/common/cpp/include/asapo/preprocessor/definitions.h b/common/cpp/include/asapo/preprocessor/definitions.h index 1f6b9fd8b7fa081969c3c79a0c033233eb296c2c..bcd62933727db56b25af9e750c0706c2607e6d1c 100644 --- a/common/cpp/include/asapo/preprocessor/definitions.h +++ b/common/cpp/include/asapo/preprocessor/definitions.h @@ -2,24 +2,13 @@ #define ASAPO_DEFINITIONS_H #ifdef UNIT_TESTS -#define VIRTUAL virtual -#define FINAL +#define ASAPO_VIRTUAL virtual +#define ASAPO_FINAL #else -#define VIRTUAL -#define FINAL final +#define ASAPO_VIRTUAL +#define ASAPO_FINAL final #endif -#if defined(__GNUC__) || defined(__clang__) -#define DEPRECATED(msg) __attribute__((deprecated(msg))) -#elif defined(_MSC_VER) -#define DEPRECATED(msg) __declspec(deprecated(msg)) -#else -#pragma message("WARNING: You need to implement DEPRECATED for this compiler") -#define DEPRECATED(msg) -#endif - - - namespace asapo { const char kPathSeparator = #ifdef WIN32 diff --git a/common/cpp/include/asapo/preprocessor/deprecated.h b/common/cpp/include/asapo/preprocessor/deprecated.h new file mode 100644 index 0000000000000000000000000000000000000000..0cf579285d2b3fb73375400f235666461778314d --- /dev/null +++ b/common/cpp/include/asapo/preprocessor/deprecated.h @@ -0,0 +1,13 @@ +#ifndef ASAPO_DEPRECATED_H +#define ASAPO_DEPRECATED_H + +#if defined(__GNUC__) || defined(__clang__) +#define ASAPO_DEPRECATED(msg) __attribute__((deprecated(msg))) +#elif defined(_MSC_VER) +#define ASAPO_DEPRECATED(msg) __declspec(deprecated(msg)) +#else +#pragma message("WARNING: You need to implement DEPRECATED for this compiler") +#define ASAPO_DEPRECATED(msg) +#endif + +#endif //ASAPO_DEPRECATED_H diff --git a/common/cpp/include/asapo/request/request_pool.h b/common/cpp/include/asapo/request/request_pool.h index 32be614b0f7aaa0a3168778255f916d928ea6ad2..638f98acaa84dadfd6b40e4ffce9a4886e8e0038 100644 --- a/common/cpp/include/asapo/request/request_pool.h +++ b/common/cpp/include/asapo/request/request_pool.h @@ -27,13 +27,13 @@ class RequestPool { }; public: explicit RequestPool(uint8_t n_threads, RequestHandlerFactory* request_handler_factory, const AbstractLogger* log); - VIRTUAL Error AddRequest(GenericRequestPtr request, bool top_priority = false); - VIRTUAL void SetLimits(RequestPoolLimits limits); - VIRTUAL Error AddRequests(GenericRequests requests); - VIRTUAL ~RequestPool(); - VIRTUAL uint64_t NRequestsInPool(); - VIRTUAL uint64_t UsedMemoryInPool(); - VIRTUAL Error WaitRequestsFinished(uint64_t timeout_ms); + ASAPO_VIRTUAL Error AddRequest(GenericRequestPtr request, bool top_priority = false); + ASAPO_VIRTUAL void SetLimits(RequestPoolLimits limits); + ASAPO_VIRTUAL Error AddRequests(GenericRequests requests); + ASAPO_VIRTUAL ~RequestPool(); + ASAPO_VIRTUAL uint64_t NRequestsInPool(); + ASAPO_VIRTUAL uint64_t UsedMemoryInPool(); + ASAPO_VIRTUAL Error WaitRequestsFinished(uint64_t timeout_ms); void StopThreads(); private: const AbstractLogger* log__; diff --git a/consumer/api/cpp/src/tcp_connection_pool.h b/consumer/api/cpp/src/tcp_connection_pool.h index 7d775133a768099c2b48324f2dc756772290e938..963d92036db4f5fcbab92657a70c06fa9ab7df88 100644 --- a/consumer/api/cpp/src/tcp_connection_pool.h +++ b/consumer/api/cpp/src/tcp_connection_pool.h @@ -16,10 +16,10 @@ struct TcpConnectionInfo { class TcpConnectionPool { public: - VIRTUAL SocketDescriptor GetFreeConnection(const std::string& source, bool* reused, Error* err); - VIRTUAL SocketDescriptor Reconnect(SocketDescriptor sd, Error* err); - VIRTUAL void ReleaseConnection(SocketDescriptor sd); - VIRTUAL ~TcpConnectionPool() = default; + ASAPO_VIRTUAL SocketDescriptor GetFreeConnection(const std::string& source, bool* reused, Error* err); + ASAPO_VIRTUAL SocketDescriptor Reconnect(SocketDescriptor sd, Error* err); + ASAPO_VIRTUAL void ReleaseConnection(SocketDescriptor sd); + ASAPO_VIRTUAL ~TcpConnectionPool() = default; TcpConnectionPool(); std::unique_ptr<IO> io__; private: diff --git a/producer/api/cpp/include/asapo/producer/producer.h b/producer/api/cpp/include/asapo/producer/producer.h index f77aae08db7c90be4c523a48128a01670e8269af..6876202b773f64e1ee1115d8c85be60a3207b1bc 100644 --- a/producer/api/cpp/include/asapo/producer/producer.h +++ b/producer/api/cpp/include/asapo/producer/producer.h @@ -7,7 +7,7 @@ #include "asapo/logger/logger.h" #include "common.h" #include "asapo/common/data_structs.h" -#include "asapo/preprocessor/definitions.h" +#include "asapo/preprocessor/deprecated.h" namespace asapo { @@ -127,7 +127,7 @@ class Producer { \param callback - callback function \return Error - will be nullptr on success */ - virtual Error DEPRECATED("obsolates 01.07.2022, use SendBeamtimeMetadata instead") SendMetadata( + virtual Error ASAPO_DEPRECATED("obsolates 01.07.2022, use SendBeamtimeMetadata instead") SendMetadata( const std::string& metadata, RequestCallback callback) = 0; diff --git a/producer/api/cpp/src/receiver_discovery_service.h b/producer/api/cpp/src/receiver_discovery_service.h index a2949ec1b638905ed61f81a14a6daaa316b584c2..0eef099913e22811046eae8c5227fb279684971f 100644 --- a/producer/api/cpp/src/receiver_discovery_service.h +++ b/producer/api/cpp/src/receiver_discovery_service.h @@ -19,11 +19,11 @@ using ReceiversList = std::vector<std::string>; class ReceiverDiscoveryService { public: explicit ReceiverDiscoveryService(std::string endpoint, uint64_t update_frequency_ms); - VIRTUAL void StartCollectingData(); - VIRTUAL ~ReceiverDiscoveryService(); - VIRTUAL uint64_t MaxConnections(); - VIRTUAL ReceiversList RotatedUriList(uint64_t nthread); - VIRTUAL uint64_t UpdateFrequency(); + ASAPO_VIRTUAL void StartCollectingData(); + ASAPO_VIRTUAL ~ReceiverDiscoveryService(); + ASAPO_VIRTUAL uint64_t MaxConnections(); + ASAPO_VIRTUAL ReceiversList RotatedUriList(uint64_t nthread); + ASAPO_VIRTUAL uint64_t UpdateFrequency(); public: std::unique_ptr<HttpClient> httpclient__; const AbstractLogger* log__; diff --git a/producer/event_monitor_producer/src/system_folder_watch_macos_dummy.h b/producer/event_monitor_producer/src/system_folder_watch_macos_dummy.h index 3c22b6aa7dfab48d66e2fb9af24bf6b8b24e1f82..0ef23b75a73299a0c3a501fe5bbe926e03769254 100644 --- a/producer/event_monitor_producer/src/system_folder_watch_macos_dummy.h +++ b/producer/event_monitor_producer/src/system_folder_watch_macos_dummy.h @@ -12,11 +12,11 @@ namespace asapo { class SystemFolderWatch { public: - VIRTUAL ~SystemFolderWatch() = default; - VIRTUAL Error StartFolderMonitor(const std::string&, const std::vector<std::string>&) { + ASAPO_VIRTUAL ~SystemFolderWatch() = default; + ASAPO_VIRTUAL Error StartFolderMonitor(const std::string&, const std::vector<std::string>&) { return nullptr; }; - VIRTUAL FilesToSend GetFileList(Error*) { + ASAPO_VIRTUAL FilesToSend GetFileList(Error*) { return {}; }; }; diff --git a/receiver/src/data_cache.h b/receiver/src/data_cache.h index 0db4fb66e9a0d06adff3853466b6905998e65b01..78264e62285a0abffe98fd1e06114400628ef513 100644 --- a/receiver/src/data_cache.h +++ b/receiver/src/data_cache.h @@ -21,10 +21,10 @@ struct CacheMeta { class DataCache { public: explicit DataCache(uint64_t cache_size_gb, float keepunlocked_ratio); - VIRTUAL void* GetFreeSlotAndLock(uint64_t size, CacheMeta** meta); - VIRTUAL void* GetSlotToReadAndLock(uint64_t id, uint64_t data_size, CacheMeta** meta); - VIRTUAL bool UnlockSlot(CacheMeta* meta); - VIRTUAL ~DataCache() = default; + ASAPO_VIRTUAL void* GetFreeSlotAndLock(uint64_t size, CacheMeta** meta); + ASAPO_VIRTUAL void* GetSlotToReadAndLock(uint64_t id, uint64_t data_size, CacheMeta** meta); + ASAPO_VIRTUAL bool UnlockSlot(CacheMeta* meta); + ASAPO_VIRTUAL ~DataCache() = default; private: uint64_t cache_size_; float keepunlocked_ratio_; diff --git a/receiver/src/receiver_data_server/request_handler/receiver_data_server_request_handler_factory.h b/receiver/src/receiver_data_server/request_handler/receiver_data_server_request_handler_factory.h index 45550411da798f66067fefec64b0a6d5465e7683..3c49704cf35c3173d2140c63878632aebb247599 100644 --- a/receiver/src/receiver_data_server/request_handler/receiver_data_server_request_handler_factory.h +++ b/receiver/src/receiver_data_server/request_handler/receiver_data_server_request_handler_factory.h @@ -14,7 +14,7 @@ namespace asapo { class ReceiverDataServerRequestHandlerFactory : public RequestHandlerFactory { public: ReceiverDataServerRequestHandlerFactory(RdsNetServer* server, DataCache* data_cache, Statistics* statistics); - VIRTUAL std::unique_ptr<RequestHandler> NewRequestHandler(uint64_t thread_id, uint64_t* shared_counter) override; + ASAPO_VIRTUAL std::unique_ptr<RequestHandler> NewRequestHandler(uint64_t thread_id, uint64_t* shared_counter) override; private: RdsNetServer* server_; DataCache* data_cache_; diff --git a/receiver/src/request.h b/receiver/src/request.h index 47e3eacffb43d6aaaebce476aaa8f9146f741ec6..a7d8402e8df7a694fdf263e57b8d5493675932a1 100644 --- a/receiver/src/request.h +++ b/receiver/src/request.h @@ -26,56 +26,56 @@ class RequestHandlerDbCheckRequest; class Request { public: - VIRTUAL Error Handle(ReceiverStatistics*); - VIRTUAL ~Request() = default; + ASAPO_VIRTUAL Error Handle(ReceiverStatistics*); + ASAPO_VIRTUAL ~Request() = default; Request() = delete; Request(const GenericRequestHeader& request_header, SocketDescriptor socket_fd, std::string origin_uri, DataCache* cache, const RequestHandlerDbCheckRequest* db_check_handler); - VIRTUAL void AddHandler(const ReceiverRequestHandler*); - VIRTUAL const RequestHandlerList& GetListHandlers() const; - VIRTUAL uint64_t GetDataSize() const; - VIRTUAL uint64_t GetMetaDataSize() const; - VIRTUAL uint64_t GetDataID() const; - VIRTUAL std::string GetFileName() const; - VIRTUAL std::string GetStream() const; - VIRTUAL std::string GetApiVersion() const; - VIRTUAL void* GetData() const; - VIRTUAL Opcode GetOpCode() const; - VIRTUAL const char* GetMessage() const; - - VIRTUAL const std::string& GetOriginUri() const; - VIRTUAL const std::string& GetOriginHost() const; - VIRTUAL const std::string& GetMetaData() const; - VIRTUAL const std::string& GetBeamtimeId() const; - VIRTUAL void SetBeamtimeId(std::string beamtime_id); - VIRTUAL void SetBeamline(std::string beamline); - - VIRTUAL void SetSourceType(SourceType); - VIRTUAL SourceType GetSourceType() const; - - VIRTUAL const std::string& GetDataSource() const; - VIRTUAL void SetDataSource(std::string data_source); - VIRTUAL void SetMetadata(std::string metadata); - - VIRTUAL void SetOnlinePath(std::string facility); - VIRTUAL void SetOfflinePath(std::string path); - VIRTUAL const std::string& GetOnlinePath() const; - VIRTUAL const std::string& GetOfflinePath() const; - - VIRTUAL const std::string& GetBeamline() const; - VIRTUAL const CustomRequestData& GetCustomData() const; - VIRTUAL Error PrepareDataBufferAndLockIfNeeded(); - VIRTUAL void UnlockDataBufferIfNeeded(); - VIRTUAL SocketDescriptor GetSocket() const ; + ASAPO_VIRTUAL void AddHandler(const ReceiverRequestHandler*); + ASAPO_VIRTUAL const RequestHandlerList& GetListHandlers() const; + ASAPO_VIRTUAL uint64_t GetDataSize() const; + ASAPO_VIRTUAL uint64_t GetMetaDataSize() const; + ASAPO_VIRTUAL uint64_t GetDataID() const; + ASAPO_VIRTUAL std::string GetFileName() const; + ASAPO_VIRTUAL std::string GetStream() const; + ASAPO_VIRTUAL std::string GetApiVersion() const; + ASAPO_VIRTUAL void* GetData() const; + ASAPO_VIRTUAL Opcode GetOpCode() const; + ASAPO_VIRTUAL const char* GetMessage() const; + + ASAPO_VIRTUAL const std::string& GetOriginUri() const; + ASAPO_VIRTUAL const std::string& GetOriginHost() const; + ASAPO_VIRTUAL const std::string& GetMetaData() const; + ASAPO_VIRTUAL const std::string& GetBeamtimeId() const; + ASAPO_VIRTUAL void SetBeamtimeId(std::string beamtime_id); + ASAPO_VIRTUAL void SetBeamline(std::string beamline); + + ASAPO_VIRTUAL void SetSourceType(SourceType); + ASAPO_VIRTUAL SourceType GetSourceType() const; + + ASAPO_VIRTUAL const std::string& GetDataSource() const; + ASAPO_VIRTUAL void SetDataSource(std::string data_source); + ASAPO_VIRTUAL void SetMetadata(std::string metadata); + + ASAPO_VIRTUAL void SetOnlinePath(std::string facility); + ASAPO_VIRTUAL void SetOfflinePath(std::string path); + ASAPO_VIRTUAL const std::string& GetOnlinePath() const; + ASAPO_VIRTUAL const std::string& GetOfflinePath() const; + + ASAPO_VIRTUAL const std::string& GetBeamline() const; + ASAPO_VIRTUAL const CustomRequestData& GetCustomData() const; + ASAPO_VIRTUAL Error PrepareDataBufferAndLockIfNeeded(); + ASAPO_VIRTUAL void UnlockDataBufferIfNeeded(); + ASAPO_VIRTUAL SocketDescriptor GetSocket() const ; std::unique_ptr<IO> io__; DataCache* cache__ = nullptr; - VIRTUAL uint64_t GetSlotId() const; - VIRTUAL bool WasAlreadyProcessed() const; - VIRTUAL void SetAlreadyProcessedFlag(); - VIRTUAL void SetResponseMessage(std::string message, ResponseMessageType type); - VIRTUAL ResponseMessageType GetResponseMessageType() const; - VIRTUAL const std::string& GetResponseMessage() const; - VIRTUAL Error CheckForDuplicates(); + ASAPO_VIRTUAL uint64_t GetSlotId() const; + ASAPO_VIRTUAL bool WasAlreadyProcessed() const; + ASAPO_VIRTUAL void SetAlreadyProcessedFlag(); + ASAPO_VIRTUAL void SetResponseMessage(std::string message, ResponseMessageType type); + ASAPO_VIRTUAL ResponseMessageType GetResponseMessageType() const; + ASAPO_VIRTUAL const std::string& GetResponseMessage() const; + ASAPO_VIRTUAL Error CheckForDuplicates(); private: const GenericRequestHeader request_header_; const SocketDescriptor socket_fd_; diff --git a/receiver/src/request_handler/authorization_client.h b/receiver/src/request_handler/authorization_client.h index 2312a41dbbad39b757cd6b29cd0e55fd24736ab2..30deb97db0085287d33a4ee8b3dbccb8b70d33e3 100644 --- a/receiver/src/request_handler/authorization_client.h +++ b/receiver/src/request_handler/authorization_client.h @@ -14,10 +14,10 @@ class AbstractLogger; class AuthorizationClient { public: AuthorizationClient(); - VIRTUAL Error Authorize(const Request* request, AuthorizationData* data) const; + ASAPO_VIRTUAL Error Authorize(const Request* request, AuthorizationData* data) const; const AbstractLogger* log__; std::unique_ptr<HttpClient> http_client__; - VIRTUAL ~AuthorizationClient() = default; + ASAPO_VIRTUAL ~AuthorizationClient() = default; private: Error DoServerRequest(const std::string& request_string, std::string* response, HttpCode* code) const; diff --git a/receiver/src/request_handler/request_handler_db_check_request.h b/receiver/src/request_handler/request_handler_db_check_request.h index d28dc7dffc3f98b749ca6448a20a54862e7bce62..d08d356c651154f8dea2e7db758cb0a2be7f4010 100644 --- a/receiver/src/request_handler/request_handler_db_check_request.h +++ b/receiver/src/request_handler/request_handler_db_check_request.h @@ -9,7 +9,7 @@ namespace asapo { -class RequestHandlerDbCheckRequest FINAL : public RequestHandlerDb { +class RequestHandlerDbCheckRequest ASAPO_FINAL : public RequestHandlerDb { public: RequestHandlerDbCheckRequest(std::string collection_name_prefix); Error ProcessRequest(Request* request) const override; diff --git a/receiver/src/request_handler/requests_dispatcher.h b/receiver/src/request_handler/requests_dispatcher.h index b18da4725c1fbbaa7ce309f118a31c71769adefb..051f8efb0993de1ff96d321c0c90c2346bbac5bf 100644 --- a/receiver/src/request_handler/requests_dispatcher.h +++ b/receiver/src/request_handler/requests_dispatcher.h @@ -15,9 +15,9 @@ namespace asapo { class RequestsDispatcher { public: RequestsDispatcher(SocketDescriptor socket_fd, std::string address, ReceiverStatistics* statistics, SharedCache cache); - VIRTUAL Error ProcessRequest(const std::unique_ptr<Request>& request) const noexcept; - VIRTUAL std::unique_ptr<Request> GetNextRequest(Error* err) const noexcept; - VIRTUAL ~RequestsDispatcher() = default; + ASAPO_VIRTUAL Error ProcessRequest(const std::unique_ptr<Request>& request) const noexcept; + ASAPO_VIRTUAL std::unique_ptr<Request> GetNextRequest(Error* err) const noexcept; + ASAPO_VIRTUAL ~RequestsDispatcher() = default; ReceiverStatistics* statistics__; std::unique_ptr<IO> io__; const AbstractLogger* log__; diff --git a/receiver/src/statistics/receiver_statistics.h b/receiver/src/statistics/receiver_statistics.h index 4bffa21c1c9f0664f4190355934ed541ef873ec9..fed59994b622f125f20600f75f4df26b3b5f83fd 100644 --- a/receiver/src/statistics/receiver_statistics.h +++ b/receiver/src/statistics/receiver_statistics.h @@ -17,8 +17,8 @@ static const std::vector<std::string> kStatisticEntityNames = {"db_share", "disk class ReceiverStatistics : public Statistics { public: ReceiverStatistics(unsigned int write_interval = kDefaultStatisticWriteIntervalMs); - VIRTUAL void StartTimer(const StatisticEntity& entity) noexcept; - VIRTUAL void StopTimer() noexcept; + ASAPO_VIRTUAL void StartTimer(const StatisticEntity& entity) noexcept; + ASAPO_VIRTUAL void StopTimer() noexcept; private: StatisticsToSend PrepareStatisticsToSend() const noexcept override; void ResetStatistics() noexcept override; diff --git a/receiver/src/statistics/statistics.h b/receiver/src/statistics/statistics.h index c6dff99969a4b9b37c165cd1f31bb8450d2d4b2e..6a8ee7c575e9a6a482e2d5421198d7465cff888b 100644 --- a/receiver/src/statistics/statistics.h +++ b/receiver/src/statistics/statistics.h @@ -27,10 +27,10 @@ struct StatisticsToSend { class Statistics { public: explicit Statistics(unsigned int write_interval = kDefaultStatisticWriteIntervalMs); - VIRTUAL void SendIfNeeded(bool send_always = false) noexcept; - VIRTUAL void IncreaseRequestCounter() noexcept; - VIRTUAL void IncreaseRequestDataVolume(uint64_t transferred_data_volume) noexcept; - VIRTUAL void AddTag(const std::string& name, const std::string& value) noexcept; + ASAPO_VIRTUAL void SendIfNeeded(bool send_always = false) noexcept; + ASAPO_VIRTUAL void IncreaseRequestCounter() noexcept; + ASAPO_VIRTUAL void IncreaseRequestDataVolume(uint64_t transferred_data_volume) noexcept; + ASAPO_VIRTUAL void AddTag(const std::string& name, const std::string& value) noexcept; void SetWriteInterval(uint64_t interval_ms); std::vector<std::unique_ptr<StatisticsSender>> statistics_sender_list__; virtual ~Statistics() = default; diff --git a/tests/automatic/bug_fixes/CMakeLists.txt b/tests/automatic/bug_fixes/CMakeLists.txt index 2dba7e68ea370aba06b84e0f85451c68f9432af0..943a450a9f62a60e55a7c2762ef40fe7bbd9b5a7 100644 --- a/tests/automatic/bug_fixes/CMakeLists.txt +++ b/tests/automatic/bug_fixes/CMakeLists.txt @@ -5,6 +5,7 @@ if (UNIX) add_subdirectory(python_deadlock) add_subdirectory(streamlist_python_multithread) add_subdirectory(error-sending-data-using-callback-method) + add_subdirectory(python_segfault_dataview) endif() endif() diff --git a/tests/automatic/bug_fixes/python_segfault_dataview/CMakeLists.txt b/tests/automatic/bug_fixes/python_segfault_dataview/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..70a676bbf19d1aa79812d38ff7026cdfbfc23253 --- /dev/null +++ b/tests/automatic/bug_fixes/python_segfault_dataview/CMakeLists.txt @@ -0,0 +1,17 @@ +set(TARGET_NAME python_deadlock_producer) + + +find_package (Python3 REQUIRED) + +if (UNIX) + get_target_property(PYTHON_LIBS_PRODUCER python-lib-producer BINARY_DIR) +else() + get_target_property(PYTHON_LIBS_PRODUCER asapo_producer BINARY_DIR) +endif() + +file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/producer_segfault.py TEST_SCRIPT ) + + +add_script_test("${TARGET_NAME}" "${TEST_SCRIPT} ${PYTHON_LIBS_PRODUCER} ${Python3_EXECUTABLE}" nomem) + + diff --git a/tests/automatic/bug_fixes/python_segfault_dataview/check_linux.sh b/tests/automatic/bug_fixes/python_segfault_dataview/check_linux.sh new file mode 100644 index 0000000000000000000000000000000000000000..414b73f8e86ef8f9712c147e5f8fc6a5461cac35 --- /dev/null +++ b/tests/automatic/bug_fixes/python_segfault_dataview/check_linux.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +set -e + +export PYTHONPATH=$2:${PYTHONPATH} +export Python3_EXECUTABLE=$3 + +$Python3_EXECUTABLE $1 $endpoint $beamtime_id $token + + diff --git a/tests/automatic/bug_fixes/python_segfault_dataview/jira_issue.txt b/tests/automatic/bug_fixes/python_segfault_dataview/jira_issue.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d8a9a0eccbda590ce46ba37c2a0f8d249e27d6 --- /dev/null +++ b/tests/automatic/bug_fixes/python_segfault_dataview/jira_issue.txt @@ -0,0 +1 @@ +https://agira.desy.de/browse/ASAPO-159 \ No newline at end of file diff --git a/tests/automatic/bug_fixes/python_segfault_dataview/producer_segfault.py b/tests/automatic/bug_fixes/python_segfault_dataview/producer_segfault.py new file mode 100644 index 0000000000000000000000000000000000000000..0a67ae5b2057b3c6e67da9978befade5402fbaf3 --- /dev/null +++ b/tests/automatic/bug_fixes/python_segfault_dataview/producer_segfault.py @@ -0,0 +1,19 @@ +from __future__ import print_function + +import asapo_producer +import time +import numpy as np + +def callback(payload, err): + if isinstance(err, asapo_producer.AsapoServerWarning): + print("successfuly sent, but with warning from server: ", payload, err) + elif err is not None: + print("could not sent: ", payload, err) + else: + print("successfuly sent: ", payload) + +producer = asapo_producer.create_producer("google.com:8700",'processed', "beamtime", 'auto', "data_source", "token", 4, 5000) +data = np.random.random((100, 100)) + +producer.send(1, exposed_path="processed/foo.dat", stream="foo", data=data.view(np.int8), callback=callback) +