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

Feature/issue 712 timeplusd endpoints #713

Merged
merged 7 commits into from
May 16, 2024

Conversation

chenziliang
Copy link
Collaborator

@chenziliang chenziliang commented May 13, 2024

PR checklist:

  • Did you run ClangFormat ?
  • Did you separate headers to a different section in existing community code base ?
  • Did you surround proton: starts/ends for new code in existing community code base ?

Please write user-readable short description of the changes:

Fix #712

@chenziliang chenziliang self-assigned this May 13, 2024
@chenziliang chenziliang requested review from ye11ow and zliang-min May 13, 2024 19:45
@chenziliang
Copy link
Collaborator Author

@zliang-min @ye11ow fyi

@chenziliang chenziliang force-pushed the feature/issue-712-timeplusd-endpoints branch from 155c546 to 10ec395 Compare May 14, 2024 17:58
@ye11ow
Copy link

ye11ow commented May 14, 2024

Are we going to bump the major or minor version after this change?

@yokofly
Copy link
Collaborator

yokofly commented May 15, 2024

=================================================================
==2701721==ERROR: AddressSanitizer: stack-use-after-return on address 0x7f1cb734e110 at pc 0x561c828b8443 bp 0x7f1b45886370 sp 0x7f1b45886368
READ of size 8 at 0x7f1cb734e110 thread T2
    #0 0x561c828b8442 in std::__1::__unique_if<DB::RestHTTPRequestHandler>::__unique_single std::__1::make_unique[abi:v15000]<DB::RestHTTPRequestHandler, DB::IServer&, char const*&>(DB::IServer&, char const*&) contrib/llvm-project/libcxx/include/__memory/unique_ptr.h:714:36
    #1 0x561c828b824e in auto DB::HandlingRuleHTTPHandlerFactory<DB::RestHTTPRequestHandler>::HandlingRuleHTTPHandlerFactory<DB::IServer&, char const*&>(DB::IServer&, char const*&)::'lambda'()::operator()() const::'lambda'(DB::IServer&, char const*&)::operator()<DB::IServer&, char const*&>(DB::IServer&, char const*&) const src/Server/HTTPHandlerFactory.h:52:24
    #2 0x561c828b8092 in decltype(std::declval<DB::HandlingRuleHTTPHandlerFactory<DB::RestHTTPRequestHandler>::HandlingRuleHTTPHandlerFactory<DB::IServer&, char const*&>(DB::IServer&, char const*&)::'lambda'()::operator()() const::'lambda'(DB::IServer&, char const*&)>()(std::declval<DB::IServer&>(), std::declval<char const*&>())) std::__1::__invoke[abi:v15000]<DB::HandlingRuleHTTPHandlerFactory<DB::RestHTTPRequestHandler>::HandlingRuleHTTPHandlerFactory<DB::IServer&, char const*&>(DB::IServer&, char const*&)::'lambda'()::operator()() const::'lambda'(DB::IServer&, char const*&), DB::IServer&, char const*&>(DB::HandlingRuleHTTPHandlerFactory<DB::RestHTTPRequestHandler>::HandlingRuleHTTPHandlerFactory<DB::IServer&, char const*&>(DB::IServer&, char const*&)::'lambda'()::operator()() const::'lambda'(DB::IServer&, char const*&)&&, DB::IServer&, char const*&) contrib/llvm-project/libcxx/include/__functional/invoke.h:394:23
    #3 0x561c828b7f0b in decltype(auto) std::__1::__apply_tuple_impl[abi:v15000]<DB::HandlingRuleHTTPHandlerFactory<DB::RestHTTPRequestHandler>::HandlingRuleHTTPHandlerFactory<DB::IServer&, char const*&>(DB::IServer&, char const*&)::'lambda'()::operator()() const::'lambda'(DB::IServer&, char const*&), std::__1::tuple<DB::IServer&, char const*&> const, 0ul, 1ul>(DB::HandlingRuleHTTPHandlerFactory<DB::RestHTTPRequestHandler>::HandlingRuleHTTPHandlerFactory<DB::IServer&, char const*&>(DB::IServer&, char const*&)::'lambda'()::operator()() const::'lambda'(DB::IServer&, char const*&)&&, std::__1::tuple<DB::IServer&, char const*&> const&&, std::__1::__tuple_indices<0ul, 1ul>) contrib/llvm-project/libcxx/include/tuple:1789:1
    #4 0x561c828b7d6a in decltype(auto) std::__1::apply[abi:v15000]<DB::HandlingRuleHTTPHandlerFactory<DB::RestHTTPRequestHandler>::HandlingRuleHTTPHandlerFactory<DB::IServer&, char const*&>(DB::IServer&, char const*&)::'lambda'()::operator()() const::'lambda'(DB::IServer&, char const*&), std::__1::tuple<DB::IServer&, char const*&> const>(DB::HandlingRuleHTTPHandlerFactory<DB::RestHTTPRequestHandler>::HandlingRuleHTTPHandlerFactory<DB::IServer&, char const*&>(DB::IServer&, char const*&)::'lambda'()::operator()() const::'lambda'(DB::IServer&, char const*&)&&, std::__1::tuple<DB::IServer&, char const*&> const&&) contrib/llvm-project/libcxx/include/tuple:1798:1
    #5 0x561c828b7bba in DB::HandlingRuleHTTPHandlerFactory<DB::RestHTTPRequestHandler>::HandlingRuleHTTPHandlerFactory<DB::IServer&, char const*&>(DB::IServer&, char const*&)::'lambda'()::operator()() const src/Server/HTTPHandlerFactory.h:50:20
    #6 0x561c828b7862 in decltype(std::declval<DB::HandlingRuleHTTPHandlerFactory<DB::RestHTTPRequestHandler>::HandlingRuleHTTPHandlerFactory<DB::IServer&, char const*&>(DB::IServer&, char const*&)::'lambda'()&>()()) std::__1::__invoke[abi:v15000]<DB::HandlingRuleHTTPHandlerFactory<DB::RestHTTPRequestHandler>::HandlingRuleHTTPHandlerFactory<DB::IServer&, char const*&>(DB::IServer&, char const*&)::'lambda'()&>(DB::HandlingRuleHTTPHandlerFactory<DB::RestHTTPRequestHandler>::HandlingRuleHTTPHandlerFactory<DB::IServer&, char const*&>(DB::IServer&, char const*&)::'lambda'()&) contrib/llvm-project/libcxx/include/__functional/invoke.h:394:23
    #7 0x561c828b76a4 in std::__1::unique_ptr<DB::HTTPRequestHandler, std::__1::default_delete<DB::HTTPRequestHandler>> std::__1::__invoke_void_return_wrapper<std::__1::unique_ptr<DB::HTTPRequestHandler, std::__1::default_delete<DB::HTTPRequestHandler>>, false>::__call<DB::HandlingRuleHTTPHandlerFactory<DB::RestHTTPRequestHandler>::HandlingRuleHTTPHandlerFactory<DB::IServer&, char const*&>(DB::IServer&, char const*&)::'lambda'()&>(DB::IServer&, char const*&) contrib/llvm-project/libcxx/include/__functional/invoke.h:470:16
    #8 0x561c828b7502 in std::__1::__function::__default_alloc_func<DB::HandlingRuleHTTPHandlerFactory<DB::RestHTTPRequestHandler>::HandlingRuleHTTPHandlerFactory<DB::IServer&, char const*&>(DB::IServer&, char const*&)::'lambda'(), std::__1::unique_ptr<DB::HTTPRequestHandler, std::__1::default_delete<DB::HTTPRequestHandler>> ()>::operator()[abi:v15000]() contrib/llvm-project/libcxx/include/__functional/function.h:235:12
    #9 0x561c828b738a in std::__1::unique_ptr<DB::HTTPRequestHandler, std::__1::default_delete<DB::HTTPRequestHandler>> std::__1::__function::__policy_invoker<std::__1::unique_ptr<DB::HTTPRequestHandler, std::__1::default_delete<DB::HTTPRequestHandler>> ()>::__call_impl<std::__1::__function::__default_alloc_func<DB::HandlingRuleHTTPHandlerFactory<DB::RestHTTPRequestHandler>::HandlingRuleHTTPHandlerFactory<DB::IServer&, char const*&>(DB::IServer&, char const*&)::'lambda'(), std::__1::unique_ptr<DB::HTTPRequestHandler, std::__1::default_delete<DB::HTTPRequestHandler>> ()>>(std::__1::__function::__policy_storage const*) contrib/llvm-project/libcxx/include/__functional/function.h:716:16
    #10 0x561c828ac65b in std::__1::__function::__policy_func<std::__1::unique_ptr<DB::HTTPRequestHandler, std::__1::default_delete<DB::HTTPRequestHandler>> ()>::operator()[abi:v15000]() const contrib/llvm-project/libcxx/include/__functional/function.h:848:16
    #11 0x561c828ac442 in std::__1::function<std::__1::unique_ptr<DB::HTTPRequestHandler, std::__1::default_delete<DB::HTTPRequestHandler>> ()>::operator()() const contrib/llvm-project/libcxx/include/__functional/function.h:1187:12
    #12 0x561c828b6bb9 in DB::HandlingRuleHTTPHandlerFactory<DB::RestHTTPRequestHandler>::createRequestHandler(DB::HTTPServerRequest const&) src/Server/HTTPHandlerFactory.h:121:34
    #13 0x561c8289dd55 in DB::HTTPRequestHandlerFactoryMain::createRequestHandler(DB::HTTPServerRequest const&) src/Server/HTTPHandlerFactory.cpp:48:41
    #14 0x561c82a9f774 in DB::HTTPServerConnection::run() src/Server/HTTP/HTTPServerConnection.cpp:58:74
    #15 0x561c92e28004 in Poco::Net::TCPServerConnection::start() base/poco/Net/src/TCPServerConnection.cpp:43:3
    #16 0x561c92e28c00 in Poco::Net::TCPServerDispatcher::run() base/poco/Net/src/TCPServerDispatcher.cpp:115:20
    #17 0x561c93460033 in Poco::PooledThread::run() base/poco/Foundation/src/ThreadPool.cpp:199:14
    #18 0x561c934587e9 in Poco::(anonymous namespace)::RunnableHolder::run() base/poco/Foundation/src/Thread.cpp:55:11
    #19 0x561c93455c3b in Poco::ThreadImpl::runnableEntry(void*) base/poco/Foundation/src/Thread_POSIX.cpp:345:27
    #20 0x7f1cb9aa6608 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x8608) (BuildId: c6d0d79d906d62bb768421fc6dada0d5e729f177)
    #21 0x7f1cb99bb352 in __clone (/lib/x86_64-linux-gnu/libc.so.6+0x11f352) (BuildId: 87b331c034a6458c64ce09c03939e947212e18ce)

Address 0x7f1cb734e110 is located in stack of thread T0 at offset 272 in frame
    #0 0x561c828a2e0f in DB::addDefaultHandlersFactory(DB::HTTPRequestHandlerFactoryMain&, DB::IServer&, DB::AsynchronousMetrics&, bool) src/Server/HTTPHandlerFactory.cpp:211

  This frame has 20 object(s):
    [32, 48) 'retval.i'
    [64, 80) 'fmt.i'
    [96, 112) 'agg.tmp.i'
    [128, 144) 'agg.tmp1.i'
    [160, 176) 'ref.tmp.i'
    [192, 193) 'snapshot_mode_.addr'
    [208, 224) 'ref.tmp' (line 215)
    [240, 256) 'ref.tmp1' (line 215)
    [272, 280) 'prefix' (line 215) <== Memory access at offset 272 is inside this variable
    [304, 320) 'rest_handler' (line 217)
    [336, 360) 'ref.tmp5' (line 218)
    [400, 416) 'agg.tmp'
    [432, 448) 'agg.tmp8'
    [464, 480) 'rest_handler19' (line 222)
    [496, 520) 'ref.tmp22' (line 223)
    [560, 576) 'agg.tmp29'
    [592, 608) 'query_handler' (line 228)
    [624, 640) 'agg.tmp38'
    [656, 680) 'ref.tmp42' (line 235)
    [720, 744) 'ref.tmp52' (line 235)
HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork
      (longjmp and C++ exceptions *are* supported)
SUMMARY: AddressSanitizer: stack-use-after-return contrib/llvm-project/libcxx/include/__memory/unique_ptr.h:714:36 in std::__1::__unique_if<DB::RestHTTPRequestHandler>::__unique_single std::__1::make_unique[abi:v15000]<DB::RestHTTPRequestHandler, DB::IServer&, char const*&>(DB::IServer&, char const*&)
Shadow bytes around the buggy address:
  0x7f1cb734de80: f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5
  0x7f1cb734df00: f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5
  0x7f1cb734df80: f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5
  0x7f1cb734e000: f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5
  0x7f1cb734e080: f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5
=>0x7f1cb734e100: f5 f5[f5]f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5
  0x7f1cb734e180: f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5
  0x7f1cb734e200: f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5
  0x7f1cb734e280: f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5
  0x7f1cb734e300: f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5
  0x7f1cb734e380: f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5 f5
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
Thread T2 created by T0 here:
    #0 0x561c54102caa in pthread_create (build_deb/programs/proton+0x224d0caa) (BuildId: bc470e18110ca6d9458466005586230f1e31da91)
    #1 0x561c93455190 in Poco::ThreadImpl::startImpl(Poco::SharedPtr<Poco::Runnable, Poco::ReferenceCounter, Poco::ReleasePolicy<Poco::Runnable>>) base/poco/Foundation/src/Thread_POSIX.cpp:202:6
    #2 0x561c93457d2a in Poco::Thread::start(Poco::Runnable&) base/poco/Foundation/src/Thread.cpp:128:2
    #3 0x561c9345f17f in Poco::PooledThread::start() base/poco/Foundation/src/ThreadPool.cpp:85:10
    #4 0x561c934608e7 in Poco::ThreadPool::ThreadPool(int, int, int, int) base/poco/Foundation/src/ThreadPool.cpp:252:12
    #5 0x561c6ab50535 in DB::Server::main(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) programs/server/Server.cpp:788:22
    #6 0x561c92e68817 in Poco::Util::Application::run() base/poco/Util/src/Application.cpp:334:8
    #7 0x561c6ab45c51 in DB::Server::run() programs/server/Server.cpp:531:25
    #8 0x561c92eb3d62 in Poco::Util::ServerApplication::run(int, char**) base/poco/Util/src/ServerApplication.cpp:611:9
    #9 0x561c6ab3e98f in mainServer(int, char**) programs/server/Server.cpp:204:20
    #10 0x561c54158317 in main programs/main.cpp:369:12
    #11 0x7f1cb98c0082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 87b331c034a6458c64ce09c03939e947212e18ce)

==2701721==ABORTING

@yokofly yokofly merged commit 84ab07e into develop May 16, 2024
21 checks passed
yokofly added a commit that referenced this pull request Jul 1, 2024
)

in the previous PR #713 
we introduced a new API also remove `localhost:port/ping` method, but we missed some changes in the script.

Co-authored-by: haohang <[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

Successfully merging this pull request may close these issues.

timeplusd rest endpoints
3 participants