Skip to content

Instantly share code, notes, and snippets.

View escherize's full-sized avatar

bryan escherize

View GitHub Profile

Problem Statement

Investigated suspected memory leak in metabase.util.malli.registry/cache atom. Initial reports suggested unbounded memory growth during test runs.

Root Cause Analysis

The real issue wasn't a memory leak, but fundamentally broken caching for function schemas. With the original schema-cache-key implementation, schemas containing function objects generated unstable cache keys because:

(fn [x] ...) creates new function objects each time Function objects have different identity even with identical code This caused cache misses for functionally identical schemas

(ns mage.escherize.analyze-cache-misses
(:require
[clojure.edn :as edn]
[clojure.java.io :as io]
[clojure.string :as str]
[mage.util :as util]))
(defn read-log [log-file]
(map second (edn/read-string (str "[" (slurp log-file) "]"))))
https://gist.github.com/escherize/24e99c1ad6bd6bab2971d520093c2470
(ns src.dev.nocommit.malli-match
(:require
[malli.core :as mc]
[clojure.set :as set]
[clojure.string :as str]
[clojure.walk :as walk]))
(defn underive-children [tag]
"Remove all children of the given tag."
(let [children (descendants tag)]
brew install --cask google-chrome zoom spotify vlc libreoffice iterm2 visual-studio-code && \
brew install git curl htop zsh-autosuggestions neofetch && \
RUNZSH=no KEEP_ZSHRC=yes sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
env MB_FUZZ=1 yarn test-unit frontend/src/metabase/querying/expressions/fuzz.compiler.unit.spec.ts
yarn run v1.22.22
warning ../package.json: No license field
$ yarn build:cljs && jest --maxWorkers=4 frontend/src/metabase/querying/expressions/fuzz.compiler.unit.spec.ts
warning ../package.json: No license field
$ yarn && yarn build-pure:cljs
warning ../package.json: No license field
$ echo $npm_execpath | grep -q yarn || echo '\033[0;33mSorry, npm is not supported. Please use Yarn (https://yarnpkg.com/).\033[0m'
[1/5] 🔍 Validating package.json...
[2/5] 🔍 Resolving packages...
(ns mage.color
(:require
[clojure.string :as str]
[clojure.walk :as w]))
(def ^:dynamic *disable-colors*
"If set to true, all color functions will return the input string as is."
false)
(def ^:private reset
@escherize
escherize / the_script.js
Last active April 24, 2025 16:46
violent monkey script for ci rerun
// ==UserScript==
// @name GitHub Rerun Failed Jobs (Manual Trigger + Watcher) @escherize
// @namespace http://tampermonkey.net/
// @version 0.7
// @description Manually trigger a watcher to auto re-run failed GitHub Actions jobs
// @match https://github.com/*/*/actions/runs/**
// @grant none
// ==/UserScript==
(function () {
We can't make this file beautiful and searchable because it's too large.
key,value
T_z91R4pacr4kSSydTsXo,41wkQWuMn5EBP6k6hWhKB
JArUob2NhnNa-4Jv9_bRy,C4Z-dJvHread0V5c8N7hg
KfzzjB8rw7cLLOuvVxHzX,Hspx2RfhJaiHxBQlGHZuE
j56IhWzlfqt09KgDeTeuD,rN23PO0V7XzT1_l68Gzsw
0GQKgaGekPIycszgx-nZ-,-rHxNeFn0lG_6M5UDL50F
yDJ5XrWefj9cL5d_t5mc3,R2DrTvbQNpW_Ws_mUQRfA
T5RmeXxDNbUq7pQRSbm4Z,1zx-2ZnIbu_QBw6eIo9y8
WvELUjxO-rSMBe7nTWXUX,_TFhw1iLSj_xzfNnpZ63z
eFB8Dk-5wDY1OWZzJk2NS,6KszXL2RTn-MjwE4T28EX
(ns cycloj.core
(:require [clojure.walk :as walk]
[clojure.repl :as repl]
[clojure.edn :as edn]
[clojure.string :as str]))
(defn r-rresolve [s]
(try (resolve s)
(catch Exception e (try (requiring-resolve s)
(catch Exception e nil)))))