Skip to content

Instantly share code, notes, and snippets.

View ywkaras's full-sized avatar

Walt Karas ywkaras

View GitHub Profile
@ywkaras
ywkaras / PUSH.cap
Last active August 8, 2018 17:03
Slow PUSH transaction
wkaras ~/TSX/TS/bin
C$ date ; curl --verbose http://127.0.0.1:8080/ip -X PUSH -H 'Content-Length: 0' -H 'Host: httpbin.org' 2>&1 | fgrep '< HTTP/' ; date
Wed Aug 8 16:47:16 UTC 2018
0 0 0 0 0 0 0 0 --:--:-- 0:00:29 --:--:-- 0< HTTP/1.1 400 Malformed Pushed Response Header
Wed Aug 8 16:47:46 UTC 2018
wkaras ~/TSX/TS/bin
C$ date ; curl --verbose http://httpbin.org/ip -X PUSH -H 'Content-Length: 0' 2>&1 | fgrep '< HTTP/' ; date
Wed Aug 8 16:48:26 UTC 2018
< HTTP/1.1 405 METHOD NOT ALLOWED
Wed Aug 8 16:48:26 UTC 2018
@ywkaras
ywkaras / TS_debug_output.txt
Last active August 22, 2018 23:13
Caching with Accept-Encoding
[Aug 22 23:02:49.590] {0x7f48ba4dd740} DEBUG: <Cache.cc:3161 (ink_cache_init)> (cache_init) proxy.config.cache.ram_cache.size = -1 = 0Mb
[Aug 22 23:02:49.590] {0x7f48ba4dd740} DEBUG: <Cache.cc:3169 (ink_cache_init)> (cache_init) proxy.config.cache.limits.http.max_alts = 5
[Aug 22 23:02:49.590] {0x7f48ba4dd740} DEBUG: <Cache.cc:3173 (ink_cache_init)> (cache_init) cache_config_ram_cache_cutoff = 4194304 = 4Mb
[Aug 22 23:02:49.590] {0x7f48ba4dd740} DEBUG: <Cache.cc:3176 (ink_cache_init)> (cache_init) proxy.config.cache.permit.pinning = 0
[Aug 22 23:02:49.590] {0x7f48ba4dd740} DEBUG: <Cache.cc:3179 (ink_cache_init)> (cache_init) proxy.config.cache.dir.sync_frequency = 60
[Aug 22 23:02:49.591] {0x7f48ba4dd740} DEBUG: <Cache.cc:3182 (ink_cache_init)> (cache_init) proxy.config.cache.select_alternate = 1
[Aug 22 23:02:49.591] {0x7f48ba4dd740} DEBUG: <Cache.cc:3186 (ink_cache_init)> (cache_init) proxy.config.cache.max_doc_size = 0 = 0Mb
[Aug 22 23:02:49.591] {0x7f48ba4dd740} DEBUG: <Cache.cc:3189 (ink_cache_init)> (ca
@ywkaras
ywkaras / notes
Created November 8, 2018 23:30
Au / Gold Test
In TS repo subdir tests. In this dir, run ./autest.sh --ats-bin <install-ats-bin-path> -f <test-name> where <test-name>.test.py file is in the gold_tests dir tree.
Some of the python code for Au Test is in files with a .ext extension rather than a .py extension.
TS/tests/gold_tests/autest-site contains python extensions that are specific to trafficserver for Au Test.
Weird failures can be caused by a ‘stale’ env-test subdirectory. If you do ‘rm -rf env-test’, this will trigger bootstrap.py to re-run, getting the latest contents for env-test.
Test.RunDirectory - _sandbox/<test-name>
Test.TestDirectory - directory with <test-name>.test.py file.
@ywkaras
ywkaras / backtrace.txt
Last active December 16, 2019 16:54
Example of using backtrace functions
// Example of how to use GCC backtrace functions (in a plugin).
#include <cstdlib>
extern "C" int backtrace(void **frame_list, int size);
extern "C" char ** backtrace_symbols(void * const *frame_list, int size);
// ...
{
@ywkaras
ywkaras / capture.txt
Created April 26, 2019 19:21
yaml indentation oddity
$ cat load.py
import yaml
import sys
f = open(sys.argv[1], 'r')
y = yaml.load(f)
print(y)
$
$ cat y1.yaml
a:
- b: |
@ywkaras
ywkaras / threadKey.txt
Created June 3, 2019 22:02
grep for threadKey variable in source files in plugins/esi
M$ fgrep threadKey *.[ch]*
combo_handler.cc:pthread_key_t threadKey = 0;
combo_handler.cc: TSReleaseAssert(pthread_key_create(&threadKey, nullptr) == 0);
esi.cc:pthread_key_t threadKey = 0;
esi.cc: if (threadKey == 0) {
esi.cc: if ((result = pthread_key_create(&threadKey, nullptr)) != 0) {
@ywkaras
ywkaras / shasum
Last active August 2, 2019 23:43
Work-around shasum bash script for Au tests if shasum command missing but sha256sum present
if [[ -x /usr/bin/shasum ]] ; then
/usr/bin/shasum "$@"
echo "$?"
fi
if [[ ( "$1" != "-a" ) || ( "$2" != 256 ) ]] ; then
echo "first two parameters must be '-a 256'" 1>&1
exit 1
fi
@ywkaras
ywkaras / srcfmt
Last active February 11, 2020 22:40
Bash script for efficiently running clang-format on Linux
if [[ "$(uname)" != Linux ]] ; then
echo "This script only runs on Linux"
exit 1
fi
if [[ ! -d .git ]] ; then
echo "Not at root of repo"
exit 1
fi
[root@atslab03 TWATCH3]# cat x.cc
#include <iostream>
#include <cstdlib>
#include <atomic>
#include <cstdint>
#include <unistd.h>
#include <fcntl.h>
#include <pthread.h>
DEBUG_LOG("IMS Cached header time %" PRId64 " vs IMS %" PRId64, static_cast<std::int64_t>(ch_time), static_cast<std::int64_t>(txn_state->ims_time));
Because:
DEBUG_LOG("IMS Cached header time %" PRId64 " vs IMS %" PRId64, std::int64_t(ch_time), std::int64_t(txn_state->ims_time));
(constructor-style casts) is not Leif-legal.