MCS hanging every few days

308 views
Skip to first unread message

Ferran Gil Cuesta

unread,
Feb 22, 2022, 9:16:55 AM2/22/22
to MariaDB ColumnStore
Greetings,

First of all, thank you for your work on MariaDB ColumnStore. We have been using since 2017, but we wanted to upgrade our setup, starting from a fresh install of a recent version. Seems fair and simple, but problems arise.

Server details:
  • Google Cloud Engine VM, with 128GB RAM, 16 vCPUs, 500GB disk
  • Debian 10
  • MariaDB Community Server 10.6.5
  • ColumnStore 5.5 (installed following this)
Settings are mostly defaults with a few comments:
  • <VersionBufferFileSize>8GB</VersionBufferFileSize> (to mimic old-and-still-working server setting)

  • AllowDiskBasedAggregation is kept to N, but with the same database tables we can't perform a "insert into xxx select xxx from xx group by xxx". This query does work (~8minutes) in old server. In this server, enabling disk aggr, we can complete the query.

  • <TotalUmMemory>25%</TotalUmMemory>,  <NumBlocksPct>50</NumBlocksPct>

Currently, data is updated with simple inserts (using executemany, in Python), and a few selects.
Data size 100 GB, distributed in 38 tables (36 columnstore, 2 small InnoDB):
Screenshot 2022-02-22 at 14.18.11.png

After a few days of updating data from all tables, the database stops working with error: Internal error: MCS-2033: Error occurred when calling system catalog.

A full restart of the VM is required (trying via systemctl restart mariadb mariadb-columnstore does not finish after at least 30 minutes).
After restarting, all data seems fine and system continues to work for a few days. No data corruption or any manual task performed.

How can we troubleshoot this big issue? 

We recently added munin to see if we could spot anything strange. A few comments: 
  • mariadbd spikes in CPU usage once columnstore "breaks". At ~8:00am we rebooted the VM and eveything went back to normal.Screenshot 2022-02-22 at 14.26.15.png
  • It may be unrelated, but worth noting: threads keep increasing until they jump down, recurrently. When columnstore stops working, threads are kept (until the reboot). There's a relation on our update tasks and the threads growing (like if our task keeps them "open"), but we were unable to know if this is a real issue or not. Screenshot 2022-02-22 at 14.33.22.png
  • There's no swap on the server, but with 128GB of RAM, so far it seems unnecessary. Screenshot 2022-02-22 at 14.37.37.png
Additional information:
  • I am unable to find the tool columnstoreSupport in our system.
  • I think this is gone in current MCS versions (but I may be wrong, and happy to provide any additional data!)
  • The crit.log only has two lines once we rebooted this morning:
    Feb 22 07:17:33 atlas-db-inc ddlpackageproc[1260]: 33.852930 |0|0|0| C 23 CAL0008: DMLProc main process has started
    Feb 22 07:17:33 atlas-db-inc ddlpackageproc[1294]: 33.907095 |0|0|0| C 23 CAL0008: DDLProc main process has started
  • Current systemctl status of mariadb-columnstore: The cropped line says 

    Feb 22 07:17:33  mariadb-columnstore-start.sh[534]: writeengine[1315]: 33.968252 |0|0|0| I 19 CAL0060: dbbuilder system catalog status: System catalog appears to exist.  It will remain intact for reuse.  The database is not recreated.
    Screenshot 2022-02-22 at 14.53.37.png

  • Current status of mariadb:
    We constantly get the message for aborted connection, which ends with (Got an error reading communication packets) and think it's related to the threads thing we mentioned above. However, we're not sure if this eventually breaks columnstore.Screenshot 2022-02-22 at 14.57.59.png
  • Finally, I am attaching the output of mcsGetConfig -a, in case there are any settings that we could tweak or test.
Thank you very much for taking the time to help us find what is going on.
Ferran

mcsGetConfig.txt

drrtuy

unread,
Feb 23, 2022, 2:07:02 PM2/23/22
to MariaDB ColumnStore
Hey Ferran,

I am glad that you benefit from MCS.

I will start with the suggestion how to future debug the case so we can help you solving this issue. I think that number of threads indirectly points to a thread leak that happens. We need to find out what is the process that spawns/leaks so many threads. Here is the example command to monitor per-process number of threads: ps -o pid,cmd,thcount -x --sort thcount

I also replied some questions inline.

вторник, 22 февраля 2022 г. в 17:16:55 UTC+3, fg...@g-n.com:
  • I am unable to find the tool columnstoreSupport in our system.

We dropped it in favor of CMAPI. But we will introduce a replacement for this tool.
  • Current systemctl status of mariadb-columnstore: The cropped line says 
JFYI mariadb-columnstore is a one-shot unit to call bash script that starts all other units: mcs-workernode@1, mcs-controllernode etc. mariadb-columnstore journal doesn't have much info.
 

  • Current status of mariadb:
    We constantly get the message for aborted connection, which ends with (Got an error reading communication packets) and think it's related to the threads thing we mentioned above. However, we're not sure if this eventually breaks columnstore.Screenshot 2022-02-22 at 14.57.59.png

This might be interesting. Are you sure the software doesn't  quit early leaving MDB client connections behind?

Regards,
Roman

Ferran Gil Cuesta

unread,
Feb 24, 2022, 5:35:43 AM2/24/22
to MariaDB ColumnStore
Thank you very much for your reply.

We need to further debug the connections thing; currently we are not sure if the software is leaving them behind or not, but it is possible.
What we can clearly see is that the number of threads are of ExeMgr, as we can see them here:
Screenshot 2022-02-24 at 11.15.55.png
2792 at screenshot time, but they keep going up to ~5000, until they jump down to 400 to start growing again.

The command ps -o pid,cmd,thcount -x --sort thcount only lists a value of 1 for each CMD, though.

Running systemctl status mcs-* we can see some more detailed info. We see a line about jemalloc but we are unsure if this is something we already have or not on our system.

Screenshot 2022-02-24 at 11.33.23.png

Thank you in advance for your help.

Best regards,
Ferran

drrtuy

unread,
Feb 24, 2022, 9:22:58 AM2/24/22
to MariaDB ColumnStore
Replied inline.

четверг, 24 февраля 2022 г. в 13:35:43 UTC+3, fg...@g-n.com:
Thank you very much for your reply.

We need to further debug the connections thing; currently we are not sure if the software is leaving them behind or not, but it is possible.
What we can clearly see is that the number of threads are of ExeMgr, as we can see them here:
Screenshot 2022-02-24 at 11.15.55.png
2792 at screenshot time, but they keep going up to ~5000, until they jump down to 400 to start growing again.

This is already something. Having this information I doubt this is caused by your software leaving connections.
The threads of ExeMgr(and other services) have names that describes the execution phase the threads are at. I usually look at these phases uses thread view of top utility.
Could I ask you to take a screen of thread view of EM in top or somehow gets the names of the threads that sits there?
 
The command ps -o pid,cmd,thcount -x --sort thcount only lists a value of 1 for each CMD, though.

GTK this is not a universal solution. It works for me though.

Running systemctl status mcs-* we can see some more detailed info. We see a line about jemalloc but we are unsure if this is something we already have or not on our system.

Screenshot 2022-02-24 at 11.33.23.png

jemalloc is an important(for MCS) memory allocation lib. There might lots of side effects w/o jemmaloc. Unfortunately we can't officially add libjemaloc as a dependency for the engine package. Could you plz install libjemalloc into your system and restart MCS to see if it makes a difference?
 
Regards,
Roman

Ferran Gil Cuesta

unread,
Feb 24, 2022, 10:21:03 AM2/24/22
to MariaDB ColumnStore
Dear Roman,

Thanks again for your insights.
Let us add more information:

Screenshot 2022-02-24 at 15.58.33.png
It seems that we already have libjemalloc since the beginning.

Using htop we can also see the names of the threads. I am adding a couple of screenshots.
In the top-right corner we can see there are 3440threads now.
Screenshot 2022-02-24 at 16.02.50.png

Also, scrolling down we get the loooong (~3200) list of the threads under ExeMgr. Most of them are displaying "Unspecified". A few others Idle , but a minority.

Screenshot 2022-02-24 at 16.06.48.png

The command pstree also displays the total threads of each type.
Screenshot 2022-02-24 at 16.08.46.png


With ps -o pid,cmd,thcount -x --sort thcount this is what we see:

Screenshot 2022-02-24 at 16.13.09.png

This is already something. Having this information I doubt this is caused by your software leaving connections.
The server is only running MCS, not even a web server. We fill (and query) the database from externally running python scripts, so seeing the threads going up like that made us think that they were the reason (also, reducing the frequency of the updates reduces the speed of growing threads). However, we have no reason to think that threads eventually block the system (or at least it does not happen every time).

Feel free to request anything else that can be of help.
Thanks!
Ferran

drrtuy

unread,
Feb 25, 2022, 1:25:21 PM2/25/22
to MariaDB ColumnStore
I found another issue that looks like yours. Unfortunately I had no clue in the issue. I bet that the cluster eventually fails when the threads count reaches certain number. From here I see two ways to address the issue: get threads call stack to analyze why and which threads are stuck and another is to repro the issue using your DDL and procedures.
Here is the procedure to get the threads call stack(you need debuginfo symbols package installed for MCS though).
gdb -p $(pidof ExeMgr) -batch -ex "set logging on"  -ex "thr apply all bt" \ -ex quit
Plz note it might take a loot time to output callstacks for all threads you have now so it might be better to do so after restart.

Plz share your ddl/ETL procedures privately if you can so I can try to repro the issue.

Regards,
Roman


четверг, 24 февраля 2022 г. в 18:21:03 UTC+3, fg...@g-n.com:

Ferran Gil Cuesta

unread,
Mar 3, 2022, 3:09:16 AM3/3/22
to MariaDB ColumnStore
Dear Roman,

Thanks for your reply.

After installing qdb, I ran the query and the output is long (as it printed 3614 threads) but just took a few seconds. It starts with a long list like

[New LWP 23715]

[New LWP 23970]

[New LWP 24102]

[New LWP 24185]

[New LWP 24222]

[New LWP 24225]

[New LWP 24299]

[New LWP 24492]

and then info about each specific thread, although they all look the same:


Thread 3611 (Thread 0x7f7a8d05d700 (LWP 26218)):

#0  __libc_read (nbytes=1, buf=0x7f88f1bf149f, fd=3439) at ../sysdeps/unix/sysv/linux/read.c:26

#1  __libc_read (fd=3439, buf=0x7f88f1bf149f, nbytes=1) at ../sysdeps/unix/sysv/linux/read.c:24

#2  0x00007f8e776f9c22 in messageqcpp::InetStreamSocket::readToMagic(long, bool*, messageqcpp::Stats*) const () from /lib/x86_64-linux-gnu/libmessageqcpp.so

#3  0x00007f8e776fa8fc in messageqcpp::InetStreamSocket::read(timespec const*, bool*, messageqcpp::Stats*) const () from /lib/x86_64-linux-gnu/libmessageqcpp.so

#4  0x00007f8e776ff4e0 in messageqcpp::CompressedInetStreamSocket::read(timespec const*, bool*, messageqcpp::Stats*) const () from /lib/x86_64-linux-gnu/libmessageqcpp.so

#5  0x0000564d5da060d5 in messageqcpp::IOSocket::read(timespec const*, bool*, messageqcpp::Stats*) const ()

#6  0x0000564d5d9fd7cb in ?? ()

#7  0x00007f8e772135e0 in threadpool::ThreadPool::beginThread() () from /lib/x86_64-linux-gnu/libthreadpool.so

#8  0x00007f8e7761b615 in ?? () from /lib/x86_64-linux-gnu/libboost_thread.so.1.67.0

#9  0x00007f8e77307fa3 in start_thread (arg=<optimized out>) at pthread_create.c:486

#10 0x00007f8e769ce4cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95


Some of them are a bit different:

Thread 1111 (Thread 0x7f820c1a6700 (LWP 1717)):

#0  futex_reltimed_wait_cancelable (private=0, reltime=0x7f820c1a4220, expected=0, futex_word=0x564d5da23174 <joblist::JobStep::jobstepThreadPool+276>) at ../sysdeps/unix/sysv/linux/futex-internal.h:142

#1  __pthread_cond_wait_common (abstime=0x7f820c1a42f0, mutex=0x564d5da23120 <joblist::JobStep::jobstepThreadPool+192>, cond=0x564d5da23148 <joblist::JobStep::jobstepThreadPool+232>) at pthread_cond_wait.c:533

#2  __pthread_cond_timedwait (cond=0x564d5da23148 <joblist::JobStep::jobstepThreadPool+232>, mutex=0x564d5da23120 <joblist::JobStep::jobstepThreadPool+192>, abstime=0x7f820c1a42f0) at pthread_cond_wait.c:667

#3  0x00007f8e77213b51 in threadpool::ThreadPool::beginThread() () from /lib/x86_64-linux-gnu/libthreadpool.so

#4  0x00007f8e7761b615 in ?? () from /lib/x86_64-linux-gnu/libboost_thread.so.1.67.0

#5  0x00007f8e77307fa3 in start_thread (arg=<optimized out>) at pthread_create.c:486

#6  0x00007f8e769ce4cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95


Thread 1110 (Thread 0x7f820c9a7700 (LWP 1716)):

#0  futex_reltimed_wait_cancelable (private=0, reltime=0x7f820c9a5220, expected=0, futex_word=0x564d5da23174 <joblist::JobStep::jobstepThreadPool+276>) at ../sysdeps/unix/sysv/linux/futex-internal.h:142

#1  __pthread_cond_wait_common (abstime=0x7f820c9a52f0, mutex=0x564d5da23120 <joblist::JobStep::jobstepThreadPool+192>, cond=0x564d5da23148 <joblist::JobStep::jobstepThreadPool+232>) at pthread_cond_wait.c:533

#2  __pthread_cond_timedwait (cond=0x564d5da23148 <joblist::JobStep::jobstepThreadPool+232>, mutex=0x564d5da23120 <joblist::JobStep::jobstepThreadPool+192>, abstime=0x7f820c9a52f0) at pthread_cond_wait.c:667

#3  0x00007f8e77213b51 in threadpool::ThreadPool::beginThread() () from /lib/x86_64-linux-gnu/libthreadpool.so

#4  0x00007f8e7761b615 in ?? () from /lib/x86_64-linux-gnu/libboost_thread.so.1.67.0

#5  0x00007f8e77307fa3 in start_thread (arg=<optimized out>) at pthread_create.c:486

#6  0x00007f8e769ce4cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95


And the last 5 are different as well:

Thread 5 (Thread 0x7f8e71fff700 (LWP 23745)):

#0  futex_reltimed_wait_cancelable (private=0, reltime=0x7f8e71ffcf50, expected=0, futex_word=0x7fff053554d8) at ../sysdeps/unix/sysv/linux/futex-internal.h:142

#1  __pthread_cond_wait_common (abstime=0x7f8e71ffd060, mutex=0x7fff05355488, cond=0x7fff053554b0) at pthread_cond_wait.c:533

#2  __pthread_cond_timedwait (cond=0x7fff053554b0, mutex=0x7fff05355488, abstime=0x7f8e71ffd060) at pthread_cond_wait.c:667

#3  0x00007f8e7720e43e in threadpool::ThreadPool::pruneThread() () from /lib/x86_64-linux-gnu/libthreadpool.so

#4  0x00007f8e7761b615 in ?? () from /lib/x86_64-linux-gnu/libboost_thread.so.1.67.0

#5  0x00007f8e77307fa3 in start_thread (arg=<optimized out>) at pthread_create.c:486

#6  0x00007f8e769ce4cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95


Thread 4 (Thread 0x7f8e72c8a700 (LWP 23743)):

#0  0x00007f8e77311bf0 in __GI___nanosleep (requested_time=0x7f8e72c885e0, remaining=0x7f8e72c885f0) at ../sysdeps/unix/sysv/linux/nanosleep.c:28

#1  0x00007f8e779c2145 in utils::MonitorProcMem::pause_() const () from /lib/x86_64-linux-gnu/libcommon.so

#2  0x0000564d5d9f8848 in ?? ()

#3  0x0000564d5d9f89b0 in ?? ()

#4  0x00007f8e7761b615 in ?? () from /lib/x86_64-linux-gnu/libboost_thread.so.1.67.0

#5  0x00007f8e77307fa3 in start_thread (arg=<optimized out>) at pthread_create.c:486

#6  0x00007f8e769ce4cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95


Thread 3 (Thread 0x7f8e73dff700 (LWP 23741)):

#0  __libc_read (nbytes=1, buf=0x7f8e7424f51f, fd=6) at ../sysdeps/unix/sysv/linux/read.c:26

#1  __libc_read (fd=6, buf=0x7f8e7424f51f, nbytes=1) at ../sysdeps/unix/sysv/linux/read.c:24

#2  0x00007f8e776f9c22 in messageqcpp::InetStreamSocket::readToMagic(long, bool*, messageqcpp::Stats*) const () from /lib/x86_64-linux-gnu/libmessageqcpp.so

#3  0x00007f8e776fa8fc in messageqcpp::InetStreamSocket::read(timespec const*, bool*, messageqcpp::Stats*) const () from /lib/x86_64-linux-gnu/libmessageqcpp.so

#4  0x00007f8e776ff4e0 in messageqcpp::CompressedInetStreamSocket::read(timespec const*, bool*, messageqcpp::Stats*) const () from /lib/x86_64-linux-gnu/libmessageqcpp.so

#5  0x00007f8e776e8e79 in messageqcpp::MessageQueueClient::read(timespec const*, bool*, messageqcpp::Stats*) const () from /lib/x86_64-linux-gnu/libmessageqcpp.so

#6  0x00007f8e784bf6a8 in joblist::DistributedEngineComm::Listen(boost::shared_ptr<messageqcpp::MessageQueueClient>, unsigned int) () from /lib/x86_64-linux-gnu/libjoblist.so

#7  0x00007f8e784bfa33 in ?? () from /lib/x86_64-linux-gnu/libjoblist.so

#8  0x00007f8e7761b615 in ?? () from /lib/x86_64-linux-gnu/libboost_thread.so.1.67.0

#9  0x00007f8e77307fa3 in start_thread (arg=<optimized out>) at pthread_create.c:486

#10 0x00007f8e769ce4cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95


Thread 2 (Thread 0x7f8e735fe700 (LWP 23739)):

#0  __libc_read (nbytes=1, buf=0x7f8e7424f58f, fd=5) at ../sysdeps/unix/sysv/linux/read.c:26

#1  __libc_read (fd=5, buf=0x7f8e7424f58f, nbytes=1) at ../sysdeps/unix/sysv/linux/read.c:24

#2  0x00007f8e776f9c22 in messageqcpp::InetStreamSocket::readToMagic(long, bool*, messageqcpp::Stats*) const () from /lib/x86_64-linux-gnu/libmessageqcpp.so

#3  0x00007f8e776fa8fc in messageqcpp::InetStreamSocket::read(timespec const*, bool*, messageqcpp::Stats*) const () from /lib/x86_64-linux-gnu/libmessageqcpp.so

#4  0x00007f8e776ff4e0 in messageqcpp::CompressedInetStreamSocket::read(timespec const*, bool*, messageqcpp::Stats*) const () from /lib/x86_64-linux-gnu/libmessageqcpp.so

#5  0x00007f8e776e8e79 in messageqcpp::MessageQueueClient::read(timespec const*, bool*, messageqcpp::Stats*) const () from /lib/x86_64-linux-gnu/libmessageqcpp.so

#6  0x00007f8e784bf6a8 in joblist::DistributedEngineComm::Listen(boost::shared_ptr<messageqcpp::MessageQueueClient>, unsigned int) () from /lib/x86_64-linux-gnu/libjoblist.so

#7  0x00007f8e784bfa33 in ?? () from /lib/x86_64-linux-gnu/libjoblist.so

#8  0x00007f8e7761b615 in ?? () from /lib/x86_64-linux-gnu/libboost_thread.so.1.67.0

#9  0x00007f8e77307fa3 in start_thread (arg=<optimized out>) at pthread_create.c:486

#10 0x00007f8e769ce4cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95


Thread 1 (Thread 0x7f8e74673f40 (LWP 23738)):

#0  0x00007f8e77311667 in __libc_accept (fd=13, addr=..., len=0x7fff053540f4) at ../sysdeps/unix/sysv/linux/accept.c:26

#1  0x00007f8e776ffa98 in messageqcpp::CompressedInetStreamSocket::accept(timespec const*) () from /lib/x86_64-linux-gnu/libmessageqcpp.so

#2  0x00007f8e776e8626 in messageqcpp::MessageQueueServer::accept(timespec const*) const () from /lib/x86_64-linux-gnu/libmessageqcpp.so

#3  0x0000564d5d9fba03 in ?? ()

#4  0x0000564d5d9f6058 in ?? ()

#5  0x00007f8e768f909b in __libc_start_main (main=0x564d5d9f5e70, argc=1, argv=0x7fff05355798, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fff05355788) at ../csu/libc-start.c:308

#6  0x0000564d5d9f750a in ?? ()

[Inferior 1 (process 23738) detached]


I can send the full output if needed, but it's just these same messages repeated so many times.

I am unsure if we have "debuginfo symbols package installed for MCS" or not, or how can we check or install them.

Thank you very much.

Ferran

drrtuy

unread,
Mar 7, 2022, 9:07:11 AM3/7/22
to MariaDB ColumnStore
I replied inline.


четверг, 3 марта 2022 г. в 11:09:16 UTC+3, fg...@g-n.com:
Thread 3611 (Thread 0x7f7a8d05d700 (LWP 26218)):

#0  __libc_read (nbytes=1, buf=0x7f88f1bf149f, fd=3439) at ../sysdeps/unix/sysv/linux/read.c:26

#1  __libc_read (fd=3439, buf=0x7f88f1bf149f, nbytes=1) at ../sysdeps/unix/sysv/linux/read.c:24

#2  0x00007f8e776f9c22 in messageqcpp::InetStreamSocket::readToMagic(long, bool*, messageqcpp::Stats*) const () from /lib/x86_64-linux-gnu/libmessageqcpp.so

#3  0x00007f8e776fa8fc in messageqcpp::InetStreamSocket::read(timespec const*, bool*, messageqcpp::Stats*) const () from /lib/x86_64-linux-gnu/libmessageqcpp.so

#4  0x00007f8e776ff4e0 in messageqcpp::CompressedInetStreamSocket::read(timespec const*, bool*, messageqcpp::Stats*) const () from /lib/x86_64-linux-gnu/libmessageqcpp.so

#5  0x0000564d5da060d5 in messageqcpp::IOSocket::read(timespec const*, bool*, messageqcpp::Stats*) const ()

#6  0x0000564d5d9fd7cb in ?? ()

#7  0x00007f8e772135e0 in threadpool::ThreadPool::beginThread() () from /lib/x86_64-linux-gnu/libthreadpool.so

#8  0x00007f8e7761b615 in ?? () from /lib/x86_64-linux-gnu/libboost_thread.so.1.67.0

#9  0x00007f8e77307fa3 in start_thread (arg=<optimized out>) at pthread_create.c:486

#10 0x00007f8e769ce4cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95


This call stack tells me ExeMgr spanws threads that are waiting for data from the plugin code(lives in MDB runtime) channel thus stuck in ::__libc_read(). Pay attention to those multiple messageqcpp::IOSocket::read that waits for __libc_read. What this tells me multiple MDB clients connect to MDB, initiate a query and then quit. Could you show me show processlist from MDB?
There are two cases I can imagine now: MDB crashes on every client connection and restarts automatically by systemd(plz use systemd statys mariadb to check when MDB restarted for the last time), there are multiple MDB client threads that you can find out with either ps(use the same shell as previously to count the number of threads)  or show processlist(use mdb client). 
 
Some of them are a bit different:

Thread 1111 (Thread 0x7f820c1a6700 (LWP 1717)):

#0  futex_reltimed_wait_cancelable (private=0, reltime=0x7f820c1a4220, expected=0, futex_word=0x564d5da23174 <joblist::JobStep::jobstepThreadPool+276>) at ../sysdeps/unix/sysv/linux/futex-internal.h:142

#1  __pthread_cond_wait_common (abstime=0x7f820c1a42f0, mutex=0x564d5da23120 <joblist::JobStep::jobstepThreadPool+192>, cond=0x564d5da23148 <joblist::JobStep::jobstepThreadPool+232>) at pthread_cond_wait.c:533

#2  __pthread_cond_timedwait (cond=0x564d5da23148 <joblist::JobStep::jobstepThreadPool+232>, mutex=0x564d5da23120 <joblist::JobStep::jobstepThreadPool+192>, abstime=0x7f820c1a42f0) at pthread_cond_wait.c:667

#3  0x00007f8e77213b51 in threadpool::ThreadPool::beginThread() () from /lib/x86_64-linux-gnu/libthreadpool.so

#4  0x00007f8e7761b615 in ?? () from /lib/x86_64-linux-gnu/libboost_thread.so.1.67.0

#5  0x00007f8e77307fa3 in start_thread (arg=<optimized out>) at pthread_create.c:486

#6  0x00007f8e769ce4cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95


These are waiting for free threads in the thread pool used by threads stuck reading from socket. 

Thread 1110 (Thread 0x7f820c9a7700 (LWP 1716)):

#0  futex_reltimed_wait_cancelable (private=0, reltime=0x7f820c9a5220, expected=0, futex_word=0x564d5da23174 <joblist::JobStep::jobstepThreadPool+276>) at ../sysdeps/unix/sysv/linux/futex-internal.h:142

#1  __pthread_cond_wait_common (abstime=0x7f820c9a52f0, mutex=0x564d5da23120 <joblist::JobStep::jobstepThreadPool+192>, cond=0x564d5da23148 <joblist::JobStep::jobstepThreadPool+232>) at pthread_cond_wait.c:533

#2  __pthread_cond_timedwait (cond=0x564d5da23148 <joblist::JobStep::jobstepThreadPool+232>, mutex=0x564d5da23120 <joblist::JobStep::jobstepThreadPool+192>, abstime=0x7f820c9a52f0) at pthread_cond_wait.c:667

#3  0x00007f8e77213b51 in threadpool::ThreadPool::beginThread() () from /lib/x86_64-linux-gnu/libthreadpool.so

#4  0x00007f8e7761b615 in ?? () from /lib/x86_64-linux-gnu/libboost_thread.so.1.67.0

#5  0x00007f8e77307fa3 in start_thread (arg=<optimized out>) at pthread_create.c:486

#6  0x00007f8e769ce4cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95


And the last 5 are different as well:


These are normal and expected.
 

I can send the full output if needed, but it's just these same messages repeated so many times.

No, I don't need this info yet.

 

I am unsure if we have "debuginfo symbols package installed for MCS" or not, or how can we check or install them.

I was talking about debuginfo packag for the corresponding MCS package you use.
You have enough ATM so you don't need to install anything else.

Regards,
Roman
 

Ferran Gil Cuesta

unread,
Mar 9, 2022, 6:51:24 AM3/9/22
to MariaDB ColumnStore
The VM is currently quite idle but somehow for the last 4 days all database tasks are slower than usual. I have not (yet) rebooted since I wanted to provide with the updated information.

I don't think that MariaDB crashes after every connection (but I may be wrong). Current uptime says 5 days.
Screenshot 2022-03-09 at 12.13.13.png

And columnstore says 2 weeks:
Screenshot 2022-03-09 at 12.13.23.png

I would say we normally see less process on the list (I will be able to check once I restart mariadb later today).
Screenshot 2022-03-09 at 12.16.47.png

For some reason for the last 4 days there are many more slow queries, which can be seen in Munin:
Screenshot 2022-03-09 at 12.37.25.png

I found out that I could obtain a few more info on processlist, which may be helpful as it displays memory used, etc. I removed the INFO column as it contains the query statement and it's usually veeeery long.

Screenshot 2022-03-09 at 12.17.31.png

The ETL we are doing into this mariadb has not changed at all. We (incrementally) add data to many tables, every few hours, and there are very few selects at the moment. I manually launch a process every week to aggregate data (it creates a temporary table, inserts data from another table doing SUM() and groupby, renames tables, drops the old table). This works fine, there's no problem in the process.

Thank you for the insights in what the outputs we provided mean.
Regards,
Ferran

Ferran Gil Cuesta

unread,
Mar 10, 2022, 4:57:37 AM3/10/22
to MariaDB ColumnStore
Hi again,
We are having another issue that may be related or not. One of the process we have creates a new table with fresh data, and then tries to rename the current table to a temporary name, and rename the fresh table to the same name. This process usually works (although we don't do it daily). This time, the alter query was queued like this:

Screenshot 2022-03-10 at 10.42.55.png

At the same time, we checked the locks but it said there are none (maybe they are different type of locks).
Screenshot 2022-03-10 at 10.47.44.png
Eventually we decided to kill that query and then manually rename the table again. It worked just fine and quick.

alter_tables.jpg

Just saying this in case it can help troubleshooting the stability issue, which is the main concern.
Thanks,
Ferran

drrtuy

unread,
Mar 11, 2022, 10:29:54 AM3/11/22
to MariaDB ColumnStore
To answer about the slow queries rate you need to find out such slow queries first. You can use either Infromation_Schema tables queries or parse /var/log/mariadb/columnstore/debug.log.

Unfortunately I_S queries doesn't accurately report RAM consumption for Columnstore-related queries. There is a columnstore specific profiling tool [1]. Unfortunately it doesn't report RAM consumption b/c of Columnstore's distributed nature.

Regards,
Roman


среда, 9 марта 2022 г. в 14:51:24 UTC+3, fg...@g-n.com:

drrtuy

unread,
Mar 11, 2022, 10:39:58 AM3/11/22
to MariaDB ColumnStore
There are different indeed. Let me explain. MDB is a SQL-frontend for MCS and it has relatively complex lock machinery on its own and 'Waiting for metadata lock'
state points to a lock inside MDB. JFYI viewtablelock shows table locks for MCS not MDB. Something is fishy. Can I take a look at the /var/log/mariadb/columnstore/debug.log that you can share with me privately?

Regards,
Roman

четверг, 10 марта 2022 г. в 12:57:37 UTC+3, fg...@g-n.com:

Ferran Gil Cuesta

unread,
Mar 14, 2022, 5:56:12 AM3/14/22
to MariaDB ColumnStore
Thanks Roman,

Last week we rebooted the whole system and the slow queries are gone. Somehow MariaDB was kind of stuck but still working, but giving those locks...  This is again under control, it seems:
Screenshot 2022-03-14 at 10.06.13.png

Also, we discussed internally how to further improve system stability and decided to do a system restart every 3 days, and see how stable everything is after that. So far it restarted once and data integrity is OK (but that's our main concern, of course). The restart itself takes only 10 seconds, but there may be some process of updating data still running at the reboot time. Just FYI.

I could call the calGetStats after running a simple query and I can see some data. Unfortunately I don't think querying data is the issue here. Long queries, that fetch data for 2 years take longer, also depending on the amount of groupbys involved, but overall this is not an issue.

Screenshot 2022-03-14 at 10.47.34.png

I can privately share the debug.log so you can see the type of inserts, queries, commits and rollbacks that are listed there. How should I proceed?

Thanks a lot!
Ferran

drrtuy

unread,
Mar 18, 2022, 2:10:20 AM3/18/22
to MariaDB ColumnStore
Greetings,

However calGetStats would allow us to confirm/deny theory that the slowdown happens in MDB plugin code to future reduce the scope.
JFYI We were able to repro EM thread explode case. More details here.
Could you confirm that the script affects you also?

Regards,
Roman

понедельник, 14 марта 2022 г. в 12:56:12 UTC+3, fg...@g-n.com:

Ferran Gil Cuesta

unread,
Mar 18, 2022, 6:56:12 AM3/18/22
to MariaDB ColumnStore
Thanks Roman,

If we can give some more information using calGetStats, just let us know and we will report back.

I tried to reproduce the issue by executing the bash script but I was unable to raise the number of (stuck?) threads.

First of all, I changed varchar(250) to text, as I was getting this error:
error_creating_table.jpg
This allowed to create the table and ran the script. There were still many varchar(100) fields and other types, so I guess our change was not relevant.

strace -p $(pidof ExeMgr)   Was printing repetitive lines, like:

accept(13, {sa_family=AF_INET, sin_port=htons(52196), sin_addr=inet_addr("127.0.0.1")}, [16]) = 66                                                      

sendto(66, "A", 1, 0, NULL, 0)          = 1      

futex(0x7fff9048cba4, FUTEX_WAKE_PRIVATE, 1) = 1                                                                                                 

accept(13, {sa_family=AF_INET, sin_port=htons(52198), sin_addr=inet_addr("127.0.0.1")}, [16]) = 67                                                                     

sendto(67, "A", 1, 0, NULL, 0)          = 1                                                                                                                                      

futex(0x7fff9048cba4, FUTEX_WAKE_PRIVATE, 1) = 1

accept(13, {sa_family=AF_INET, sin_port=htons(52200), sin_addr=inet_addr("127.0.0.1")}, [16]) = 69

sendto(69, "A", 1, 0, NULL, 0)          = 1

futex(0x7fff9048cba0, FUTEX_WAKE_PRIVATE, 1) = 1

futex(0x7fff9048cb50, FUTEX_WAKE_PRIVATE, 1) = 1

accept(13, {sa_family=AF_INET, sin_port=htons(52202), sin_addr=inet_addr("127.0.0.1")}, [16]) = 15

sendto(15, "A", 1, 0, NULL, 0)          = 1

futex(0x7fff9048cba0, FUTEX_WAKE_PRIVATE, 1) = 1

accept(13, {sa_family=AF_INET, sin_port=htons(52204), sin_addr=inet_addr("127.0.0.1")}, [16]) = 16

sendto(16, "A", 1, 0, NULL, 0)          = 1

futex(0x7fff9048cba0, FUTEX_WAKE_PRIVATE, 1) = 1

accept(13, {sa_family=AF_INET, sin_port=htons(52206), sin_addr=inet_addr("127.0.0.1")}, [16]) = 19

sendto(19, "A", 1, 0, NULL, 0)          = 1

futex(0x7fff9048cba0, FUTEX_WAKE_PRIVATE, 1) = 1


cat /proc/$(pidof PrimProc)/status | grep -i threads   It kept stable displaying 78 / 79 threads.


cat /proc/$(pidof ExeMgr)/status | grep -i threads  I saw this was up to 195 when I was running our own ETL (just updating some client data). But then I stopped out ETL, rebooted mariadb and mariadb-columnstore, and just executing the bash script of the jira report, values kept quite stable at 158.


ps -efT | grep ExeMgr | wc -l   displayed 158... then 160 but kept stable at this number.


I ran the script every 5 seconds for at least 20 minutes, and it all went OK.

After executing the script, I could briefly see the queries with show processlist; but load on the server was fine.

We did this test in a Google Cloud VM with 16 vCPU and 64GB RAM. OS was Debian 10.

Unfortunately I don't seem to be able to reproduce the issue using the script, although it looks similar to what seems to be happening to us when processing our data.

Thanks

Ferran



drrtuy

unread,
Apr 14, 2022, 8:21:46 AM4/14/22
to MariaDB ColumnStore
I was told that the script was supposed to demonstrate that multiple queries pre-spawns too many threads in ExeMgr and the header and the description of the issue is really misguiding.

We still struggle to reproduce the hanging threads issue but no luck so far.

Regards,
Roman

пятница, 18 марта 2022 г. в 13:56:12 UTC+3, fg...@g-n.com:

Ferran Gil Cuesta

unread,
Jun 23, 2022, 6:01:36 AM6/23/22
to MariaDB ColumnStore
Hey Roman,

We are still experiencing the issue that the number of threads increases until they jump down to a minimum. Also RAM usage follows the same pattern.
Somehow, it seems that ExeMgr keeps active even if the process that updates data finished time ago (we insert new data every hour, into different tables).

Screenshot 2022-06-23 at 11.47.49.png

Screenshot 2022-06-23 at 11.48.58.png

Current VM only has 64GB RAM, which means the clean-up happens more often than when we had 128GB RAM (previous setup, same issues).
Screenshot 2022-06-23 at 11.50.55.png

We reviewed the python script that fetches current data from DB, fetches data from API, compares them and inserts the difference into DB. We added some missing connection.close() but we don't see any improvement or decrease of problems.

What is worse, every 2 or 3 days, the insert queries (that usually take a second or less) increase execution time to 30 seconds, then 300... up until a point in where we really need to reboot the server completely. We set up a cron job to reboot the VM every 3 nights, but in quite a few occasions we need manually do it earlier than that.

Thank you,
Ferran

Roland Noland

unread,
Jun 23, 2022, 9:41:07 AM6/23/22
to Ferran Gil Cuesta, MariaDB ColumnStore
Hey Ferran,

Could you give me the backtraces for all the threads that ExeMgr has when it is becoming unresponsive?
You can use this oneliner:

gdb -p $(pidof ExeMgr) -batch -ex "set logging off"  -ex 'thr apply all bt' -ex 'quit'

Regards,
Roman

чт, 23 июн. 2022 г. в 13:01, Ferran Gil Cuesta <fg...@g-n.com>:
--
You received this message because you are subscribed to a topic in the Google Groups "MariaDB ColumnStore" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mariadb-columnstore/rnMcDpj6gEQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mariadb-columns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mariadb-columnstore/38cc84fc-d11c-4442-aa02-72d69d9eb80en%40googlegroups.com.

Ferran Gil Cuesta

unread,
Jun 23, 2022, 10:05:54 AM6/23/22
to MariaDB ColumnStore
Hey,

Unfortunately this is a production server now, and we try our best to avoid the unresponsive state. When this happens, sometimes a restart fixes it all, but in one case we could not keep the readwrite mode ON, and we were forced to bring up a backup instance.

Howver, I can try on our test database (which suffers the same issues, but less often, as we update data less often as well). This test DB has the same data as our production DB, and same MariaDB version, etc. I will stress the database a bit (just by running updates as in production) and see how far we can go.

The output of the qdb command right now is this: https://pastebin.com/btS8797N (it was too large to copy here). Just in case it is useful at the moment.

Thanks,
Ferran

drrtuy

unread,
Jun 26, 2022, 8:19:45 AM6/26/22
to MariaDB ColumnStore
I looked at the backtraces and I see there are too many threads waiting for a sync sequence from a TCP socket to establish data communication stream. The read from TCP socket might happen when MDB thread establishes TCP connection with ExeMgr and then sends nothing there. Could you check the correlation b/w a number of threads stuck waiting for a byte from TCP socket (use  'grep '__libc_read (nbytes=1,' /tmp/123.txt  | wc -l' on the file with backtrace from gdb) and the number of established TCP connections b/w mariadbd and ExeMgr(can get with ss -tenp | grep ExeMgr). You can check the fd numbers b/w the first output and the second All shells needs root privileges.
If the numbers are close there are multiple MDB threads that doesn't behave, namely stuck in the middle and not establish data stream after TCP connection is established.

Regards,
ROman

четверг, 23 июня 2022 г. в 17:05:54 UTC+3, fg...@g-n.com:

Ferran Gil Cuesta

unread,
Jun 28, 2022, 10:52:18 AM6/28/22
to MariaDB ColumnStore
We were able to "hang" MariaDB (seeing insert queries that usually take less than a second listed in show processlist with times of 5000 seconds, etc...). Just by enabling more updates (more frequent) on our test VM. The gdb at that moment is https://zerobin.net/?18a0890a215d8a6c#4TswmY9UTrPfTFZ2h4vTbGTjIqLvT+T9PgzMsH3JpRI= (could not paste it into pastebin as it was too large).
The 'grep '__libc_read (nbytes=1,'  for the pastebin output I sent the other day was 166. For this new paste (when the system was almost stuck) the total 1825.

Now that the VM was restarted 30 minutes ago, I see a small number (but a few minutes later it's already counting 210, etc... it keeps raising).
Screenshot 2022-06-28 at 16.43.24.png

I think they are correlated, and I think you're right when you say:
If the numbers are close there are multiple MDB threads that doesn't behave, namely stuck in the middle and not establish data stream after TCP connection is established.
However, I have no idea how to further debug or solve it. It seems clear that there's something wrong in the code that connects to the database and updates it, am I right?

Thanks,
Ferran

drrtuy

unread,
Jun 30, 2022, 3:54:01 PM6/30/22
to MariaDB ColumnStore
Do you have insert cache feature enabled or not?
Let's now take a look what happens inside MDB and why threads there stuck. Could I take a look at gdb output for MDB when the number of stuck threads at EM is higher then normal? The sequence is the same.

Regards,
Roman
вторник, 28 июня 2022 г. в 17:52:18 UTC+3, fg...@g-n.com:

Ferran Gil Cuesta

unread,
Jul 4, 2022, 5:29:11 AM7/4/22
to MariaDB ColumnStore
We were not aware of that variable. It was off by default:

Screenshot 2022-07-01 at 17.00.27.png

and it cannot be enabled inside mariadb (our first try):
Screenshot 2022-07-01 at 17.12.52.png

Then we edited my.cnf (and also edited mariadb.cnf on a second try) and from a previously opened mariadb shell we could see that the variable was set to ON. We were unable to open a new mariadb shell, it was complaining about the variable in my.cnf or mariadb.cnf:
Screenshot 2022-07-01 at 17.14.15.png
We commented out the setting to avoid having problems on mariadb or VM reboots (every 3 nights, but we are considering doing them often as we are forced to manually do some extra restarts performance degrades and inserts start taking 10 minutes...).

We looked for documentation but we only found this https://mariadb.com/docs/reference/mdb/system-variables/columnstore_cache_inserts/ (which does not explain a lot).

You wrote: Let's now take a look what happens inside MDB and why threads there stuck. Could I take a look at gdb output for MDB when the number of stuck threads at EM is higher then normal? The sequence is the same.
I am not sure of what should I do exactly. Our production VM goes up to ~3500 threads and then they reset back to 390 and start raising. The output for  sudo gdb -p $(pidof ExeMgr) -batch -ex "set logging off"  -ex 'thr apply all bt' -ex 'quit' when the VM is at 1500 threads is this.

Thank you,
Ferran

drrtuy

unread,
Jul 11, 2022, 2:53:31 AM7/11/22
to MariaDB ColumnStore
I would like to see at the output for
 sudo gdb -p $(pidof mariadbd) -batch -ex "set logging off"  -ex 'thr apply all bt' -ex 'quit'
+ journalctl -u mariadb for a day if it has any error messages.
These two outputs will tell me if it is MariaDB which threads goes away leaving threads in ExeMgr.

Regards,
Roman


понедельник, 4 июля 2022 г. в 12:29:11 UTC+3, fg...@g-n.com:

Ferran Gil Cuesta

unread,
Jul 11, 2022, 11:20:17 AM7/11/22
to MariaDB ColumnStore
The output for gdb is https://pastebin.com/T1WMZAVV
And the one for journalctl is https://pastebin.com/g79K3N4F As previously commented, there is a list of Aborted connection and Got an error reading communication packets, which match the pace of our update scripts, but we are unable to see what could be wrong in there.

I rebooted the VM 4 hours ago as it was almost stuck. Since then it has been updating data for several of the tables.
These outputs are for our test VM, which is the same as the production one, just with less CPUs and RAM (but suffers of the same issues in stability).

Thanks for all your help.
Ferran

drrtuy

unread,
Jan 17, 2023, 2:45:40 AM1/17/23
to MariaDB ColumnStore
Hey Ferran,

The community recently contributes a patch that fixes leaking connections. Here is the link to the Jira issue. I expect the patch to be out with the next Community MDB server release.

Regards,
Roman

понедельник, 11 июля 2022 г. в 18:20:17 UTC+3, fg...@g-n.com:

Ferran Gil Cuesta

unread,
Jan 17, 2023, 3:47:09 AM1/17/23
to MariaDB ColumnStore
Hey Roman,
Thank you for letting us know.
We will test the next release for sure, as we are still facing the hangs (on production!). We restart the server every 3 days and we more or less have it under control, but in some cases we need to do it manually, taking care that no locks are kept, that want to rollback, etc.

Best regards,
Ferran

Ferran Gil Cuesta

unread,
Feb 14, 2023, 5:57:32 AM2/14/23
to MariaDB ColumnStore
Hey Roman,

I've seen there's a new release of Community Server (6 Feb 2023) but it doesn't look like this bugfix was incorporated. 

Do you have any more information on future release dates? 
We are eager to test the fix and provide some feedback.

Thank you very much,
Ferran

Roland Noland

unread,
Feb 14, 2023, 6:24:02 AM2/14/23
to Ferran Gil Cuesta, MariaDB ColumnStore
Hey Ferran,

JFYI Despite the release notes doesn't give a clue on MCS current status the Columnstore was updated so plz check the behavior.
Thx for the note  I will talk to the server team about the lack of information in the release notes.

Regards,
Roman

вт, 14 февр. 2023 г. в 13:57, Ferran Gil Cuesta <fg...@g-n.com>:
You received this message because you are subscribed to the Google Groups "MariaDB ColumnStore" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mariadb-columns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mariadb-columnstore/7e06fd6a-6871-4c77-a7bd-fd459545d5adn%40googlegroups.com.

Ferran Gil Cuesta

unread,
Feb 14, 2023, 6:47:58 AM2/14/23
to Roland Noland, MariaDB ColumnStore
Hi Roman,


When ExeMgr finishes serving a request from MariaDB Server, ExeMgr's TCP connection can remain open, and its thread can continue running, which can cause ColumnStore to use more resources than required.
 
A bit hidden but glad to see it's in the lastest MCS release.

Many thanks!
Ferran

Roland Noland

unread,
Feb 14, 2023, 6:54:37 AM2/14/23
to Ferran Gil Cuesta, MariaDB ColumnStore
22.08.8 is a different release from a different branch so your original note about the lack of info in community server release is still valid.

вт, 14 февр. 2023 г., 11:47 Ferran Gil Cuesta <fg...@g-n.com>:

Roland Noland

unread,
Feb 14, 2023, 7:38:32 AM2/14/23
to Ferran Gil Cuesta, MariaDB ColumnStore
In your case you should see 6.4.7 in columnstore_version session variable.


вт, 14 февр. 2023 г., 11:47 Ferran Gil Cuesta <fg...@g-n.com>:
Hi Roman,

Ferran Gil Cuesta

unread,
Feb 15, 2023, 5:40:46 AM2/15/23
to Roland Noland, MariaDB ColumnStore
Dear Roman,

The difference in the latest release is huge. We were using 6.4.1, and now we see 6.4.7 as you said.
We deployed a new VM instance with the same load as our production server and so far we don't see any
spikes in the number of open threads and everything feels much more stable.
Just a few screenshots from munin, where you can see the old behaviour plus the new one (just a few hours):

image.png

image.png

image.png

image.png
image.png
In the last one, memory usage, the drop at 2:00am is due to the fact that we still had a cron job to 
stop mariadb & reboot the server.
We are going to remove this in the new instance and see how it goes.

So far, we can't be happier!

Thank you very much and keep up the good work!

Cheers,
Ferran

drrtuy

unread,
Feb 15, 2023, 6:47:14 PM2/15/23
to MariaDB ColumnStore
Thx for the graphs shared. They make the difference obvious. I think I need to highlight again that the original patch came from the community.

Regards,
Roman



среда, 15 февраля 2023 г. в 13:40:46 UTC+3, Ferran Gil Cuesta:
Reply all
Reply to author
Forward
0 new messages