Skip to content

Instantly share code, notes, and snippets.

@azat
azat / kazoo-logging.patch
Created December 28, 2022 09:34
Endless wait in kazoo after AUTH_FAILED on stop
diff --git a/kazoo/client.py b/kazoo/client.py
index 27b7c38..0c0ecc0 100644
--- a/kazoo/client.py
+++ b/kazoo/client.py
@@ -400,6 +400,7 @@ class KazooClient(object):
def _reset(self):
"""Resets a variety of client states for a new connection."""
+ self.logger.log(BLATHER, "Reseting the client")
self._queue = deque()
/// Test for RWF_NOWAIT, does it always non-block?
/// The answer is, it may sometimes, for example when there is some issues with the underlying disk.
/// Or maybe when it accessing page entries, that are blocked for a long time, need to take a look deeper.
#define _GNU_SOURCE /// for preadv2()
#include <sys/uio.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>
#include <stdio.h>
#include <cstdlib>
#include <memory>
struct NewDeleteOperators
{
NewDeleteOperators() = default;
static void* operator new(size_t size)
{
return ::malloc(size);
import publicsuffix2
import clickhouse_driver
ch = clickhouse_driver.Client(host='127.1')
pls = publicsuffix2.PublicSuffixList(idna=False)
def check_tld(tld):
print(tld)
host = 'foo.' + tld
ch_tld = ch.execute("SELECT cutToFirstSignificantSubdomainCustom(%(host)s, 'public_suffix_list')", params={
@azat
azat / bash_bug_wait_for.sh
Last active June 15, 2022 17:24
bash bug: wait_for: No record of process (had been fixed in bash 5.1+)
#!/usr/bin/env bash
#
# Reproducer for bash bug that had been fixed in bash 5.1+ [1], report [2]
#
# [1]: https://git.savannah.gnu.org/cgit/bash.git/commit/?h=bash-5.1&id=8868edaf2250e09c4e9a1c75ffe3274f28f38581
# [2]: https://lists.gnu.org/archive/html/bug-bash/2019-05/msg00110.html
#
function thread_worker()
#!/usr/bin/env bash
set -x
config_directives=(
--tcp_port=19000
--mlock_executable=true
)
benchmark_args=(
-d 0
From 64f9c91766cbcaa8a61e5b633ac78e354ac3355c Mon Sep 17 00:00:00 2001
From: Azat Khuzhin <[email protected]>
Date: Mon, 31 Jan 2022 19:14:53 +0300
Subject: [PATCH] fs/binfmt_elf: use ELF_ET_DYN_BASE for PIE (ET_DYN with
INTERP) binaries
Since 9630f0d60fec ELF_ET_DYN_BASE is not used as a load_bias anymore
and this breaks PIE binaries, since after this change data segment
became too nearby the stack:
#include <vector>
#include <memory>
#include <benchmark/benchmark.h>
#define LEN 1<<20
using AggregateDataPtr = char *;
struct AvgState {
uint64_t numerator{0};
uint64_t denominator{0};
$ docker run --rm --name ch -v zzz-cluster.xml:/etc/clickhouse-server/config.d/zzz-cluster.xml:ro -it yandex/clickhouse-server:20.8
# 2021.11.19 14:47:23.804900 [ 1 ] {} <Information> : Starting ClickHouse 20.8.19.4 with revision 54438, build id: C4778BE3F258FC00, PID 1
$ docker exec -i ch clickhouse client -nm --testmode < test.sql
/* Minimal exapmle of static jemalloc.
*
* $ gcc -g3 -o main main.cpp -Wl,-Bstatic -ljemalloc_pic -Wl,-Bdynamic -nodefaultlibs -lc -lpthread -ldl -lgcc
* (or if you have only libjemalloc.a then -ljemalloc)
* NOTE: order is important
*
* $ ldd main
* linux-vdso.so.1 (0x00007ffff7fcb000)
* libc.so.6 => /usr/lib/libc.so.6 (0x00007ffff7b22000)
* libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007ffff7b01000)