Dears, I have an issue with adding analytics rule....
# community-help
p
Dears, I have an issue with adding analytics rule. When I'm trying to insert analytics rule to existing collection via PHP library, I see an error: Not Ready or Lagging When I try to add it by curl, I see curl: (16) Error in the HTTP2 framing layer Server version: 27.1 My curl query:
Copy code
curl -k "<https://xxx:8108/analytics/rules>" \                                         
      -X POST \
      -H "Content-Type: application/json" \
      -H "X-TYPESENSE-API-KEY: xyz" \
      -d '{
        "name": "default_products_aggregation_rule",
        "type": "popular_queries",
        "params": {
            "source": {
                "collections": ["default_products_1734087120"]
            },
            "destination": {
                "collection": "default_products_aggregation"
            },
            "limit": 1000
        }
      }'
It seems server is crushing:
Copy code
E20241213 12:15:33.232095 21235 backward.hpp:4200] Stack trace (most recent call last) in thread 21235:
E20241213 12:15:33.232256 21235 backward.hpp:4200] #13   Object "", at 0xffffffffffffffff, in 
E20241213 12:15:33.232277 21235 backward.hpp:4200] #12   Object "/usr/lib/x86_64-linux-gnu/libc.so.6", at 0x7fe9fb6b384f, in 
E20241213 12:15:33.232293 21235 backward.hpp:4200] #11   Object "/usr/lib/x86_64-linux-gnu/libc.so.6", at 0x7fe9fb621ac2, in 
E20241213 12:15:33.232308 21235 backward.hpp:4200] #10   Object "/usr/bin/typesense-server", at 0x55fa404c5c33, in execute_native_thread_routine
E20241213 12:15:33.232323 21235 backward.hpp:4200] #9  | Source "include/threadpool.h", line 59, in operator()
E20241213 12:15:33.232337 21235 backward.hpp:4200]     | Source "/usr/include/c++/10/future", line 1592, in _M_run
E20241213 12:15:33.232353 21235 backward.hpp:4200]     | Source "/usr/include/c++/10/future", line 1459, in _M_set_result
E20241213 12:15:33.232383 21235 backward.hpp:4200]     | Source "/usr/include/c++/10/future", line 412, in call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>()>*, bool*>
E20241213 12:15:33.232414 21235 backward.hpp:4200]     | Source "/usr/include/c++/10/mutex", line 729, in __gthread_once
E20241213 12:15:33.232431 21235 backward.hpp:4200]       Source "/usr/include/x86_64-linux-gnu/c++/10/bits/gthr-default.h", line 700, in ThreadPool [0x55fa3d959945]
E20241213 12:15:33.232451 21235 backward.hpp:4200] #8    Object "/usr/lib/x86_64-linux-gnu/libc.so.6", at 0x7fe9fb626ee7, in 
E20241213 12:15:33.232475 21235 backward.hpp:4200] #7  | Source "/usr/include/c++/10/future", line 572, in operator()
E20241213 12:15:33.232494 21235 backward.hpp:4200]       Source "/usr/include/c++/10/bits/std_function.h", line 622, in _M_do_set [0x55fa3d958c92]
E20241213 12:15:33.232515 21235 backward.hpp:4200] #6  | Source "/usr/include/c++/10/bits/std_function.h", line 292, in __invoke_r<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<_Fn, _Alloc, _Res(_Args ...)>::_M_run<std::_Bind<BatchedIndexer::run()::<lambda()>()>, std::allocator<int>, void, {}>::<lambda()>, void>&>
E20241213 12:15:33.232542 21235 backward.hpp:4200]     | Source "/usr/include/c++/10/bits/invoke.h", line 115, in __invoke_impl<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<_Fn, _Alloc, _Res(_Args ...)>::_M_run<std::_Bind<BatchedIndexer::run()::<lambda()>()>, std::allocator<int>, void, {}>::<lambda()>, void>&>
E20241213 12:15:33.232595 21235 backward.hpp:4200]     | Source "/usr/include/c++/10/bits/invoke.h", line 60, in operator()
E20241213 12:15:33.232616 21235 backward.hpp:4200]     | Source "/usr/include/c++/10/future", line 1397, in operator()
E20241213 12:15:33.232640 21235 backward.hpp:4200]     | Source "/usr/include/c++/10/future", line 1456, in __invoke_r<void, std::_Bind<BatchedIndexer::run()::<lambda()>()>&>
E20241213 12:15:33.232661 21235 backward.hpp:4200]     | Source "/usr/include/c++/10/bits/invoke.h", line 110, in __invoke_impl<void, std::_Bind<BatchedIndexer::run()::<lambda()>()>&>
E20241213 12:15:33.232682 21235 backward.hpp:4200]     | Source "/usr/include/c++/10/bits/invoke.h", line 60, in operator()<>
E20241213 12:15:33.232702 21235 backward.hpp:4200]     | Source "/usr/include/c++/10/functional", line 499, in __call<void>
E20241213 12:15:33.232721 21235 backward.hpp:4200]     | Source "/usr/include/c++/10/functional", line 416, in __invoke<BatchedIndexer::run()::<lambda()>&>
E20241213 12:15:33.232739 21235 backward.hpp:4200]     | Source "/usr/include/c++/10/bits/invoke.h", line 95, in __invoke_impl<void, BatchedIndexer::run()::<lambda()>&>
E20241213 12:15:33.232765 21235 backward.hpp:4200]       Source "/usr/include/c++/10/bits/invoke.h", line 60, in _M_invoke [0x55fa3d952a58]
E20241213 12:15:33.232785 21235 backward.hpp:4200] #5    Source "src/batched_indexer.cpp", line 292, in operator() [0x55fa3d951a8b]
E20241213 12:15:33.232802 21235 backward.hpp:4200] #4    Source "src/core_api.cpp", line 2847, in post_create_analytics_rules [0x55fa3da9abed]
E20241213 12:15:33.232824 21235 backward.hpp:4200] #3    Source "src/analytics_manager.cpp", line 27, in create_rule [0x55fa3d8e4425]
E20241213 12:15:33.232843 21235 backward.hpp:4200] #2    Source "src/analytics_manager.cpp", line 239, in create_index [0x55fa3d8e2ffc]
E20241213 12:15:33.232860 21235 backward.hpp:4200] #1  | Source "src/store.cpp", line 68, in shared_lock
E20241213 12:15:33.232882 21235 backward.hpp:4200]     | Source "/usr/include/c++/10/shared_mutex", line 722, in lock_shared
E20241213 12:15:33.232901 21235 backward.hpp:4200]     | Source "/usr/include/c++/10/shared_mutex", line 421, in lock_shared
E20241213 12:15:33.232921 21235 backward.hpp:4200]     | Source "/usr/include/c++/10/shared_mutex", line 224, in __glibcxx_rwlock_rdlock
E20241213 12:15:33.232950 21235 backward.hpp:4200]       Source "/usr/include/c++/10/shared_mutex", line 73, in insert [0x55fa3dc52d10]
E20241213 12:15:33.233001 21235 backward.hpp:4200] #0    Object "/usr/lib/x86_64-linux-gnu/libc.so.6", at 0x7fe9fb62764c, in __pthread_rwlock_rdlock
I20241213 12:15:34.440737 21235 batched_indexer.cpp:534] Saving currently applying index: 4569896
I20241213 12:15:34.440949 21235 core_api.cpp:71] Dump of in-flight search queries:
I20241213 12:15:34.440992 21235 core_api.cpp:83] id=1734092132535250, qs=?collection=magento_2_default_products&facet_query=&limit=5&page=0&q=sad&query_by=name&sort_by=&, body={"searches":[{"collection":"magento_2_default_products","q":"sad","query_by":"name","limit":"5","page":0}]}
E20241213 12:15:34.441004 21235 typesense_server.cpp:135] Typesense 27.1 is terminating abruptly.
Log file created at: 2024/12/13 12:15:34
Running on machine: typesense
Running duration (h:mm:ss): 0:00:00
@Jason Bosco may I ask for help?
f
Hey there. Can you provide a reproducible example for us to check? Also, what Typesense version are you using?
It seems you're using
v27.1
from the logs here. Is this self hosted or cloud?
p
Its self hosted, ubuntu 24.04.1 LTS
What kied of data do you need?
f
Is it built from source, or using the latest binary? Also, is it running on bare metal or docker?
Just a couple set of curl commands so we can find what's causing the issue
p
It is downloaded from binary
Copy code
curl -O <https://dl.typesense.org/releases/27.1/typesense-server-27.1-amd64.deb>
I'm using digitalocean droplet as the server
what type of commands? It is failing on the analytics/rule which I posted on the first message
doesn't matter if collection have documents or not (i tried on few collections with different fields)
j
Could you make sure the analytics-dir server parameter is specified and the directory is present?
We’ve already fixed this bug in v28.0.rc, but in v27, the process crashes if that directory is not present when an analytics rule is used.
p
sure, let me check
Yep, it was that
thank you for your support!
👍 1