Skip to content

Instantly share code, notes, and snippets.

@vlovich
vlovich / valgrind_hang_repro.rs
Created September 30, 2023 22:56
Another repro for issue glomimo#582 maybe.
// tokio = { version = "1.32", default-features = false, features = ["sync"] }
// glommio = { git = "https://github.com/DataDog/glommio.git" }
use tokio::sync::*;
fn main() {
let (send_dispatcher, recv_dispatcher) = oneshot::channel();
let async_thread = std::thread::spawn(move || {
eprintln!("BACKGROUND: Creating channel in thread");
let (dispatcher, mut receiver) = mpsc::unbounded_channel();
@vlovich
vlovich / read_write.c
Created September 26, 2023 16:22
Debugging for glommio issue 605
// clang -std=c11 read_write.c -luring && ./a.out
#define _GNU_SOURCE
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <liburing.h>
/*
Cargo.toml
[package]
name = "tmp"
version = "0.0.1"
resolver = "2"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
@vlovich
vlovich / alkahest compile error
Created September 18, 2023 20:37
Problem with Bincode + SerializeRef
error[E0277]: the trait bound `Bincoded<SerdeStruct>: BareFormula` is not satisfied
--> src/main.rs:17:1
|
17 | #[alkahest(Serialize<SomeEnumFormula>, SerializeRef<SomeEnumFormula>, for<'a> Deserialize<'a, SomeEnumFormula>)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `BareFormula` is not implemented for `Bincoded<SerdeStruct>`
|
= note: required for `&SerdeStruct` to implement `alkahest::Serialize<Bincoded<SerdeStruct>>`
note: required by a bound in `WithFormula::<F>::write_field`
--> ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/alkahest-0.3.0/src/lib.rs:149:16
|
@vlovich
vlovich / drd report
Created December 5, 2022 15:18
drd report of glommio deadlock
d): /home/vlovich/valgrind-deadlock
DW_AT_GNU_pubnames: 1
DW_AT_low_pc : 0x3d040
DW_AT_high_pc : 82
parse_type_DIE:
--24107-- WARNING: Serious error when reading debug info
--24107-- When reading debug info from /home/vlovich/valgrind-deadlock/target/debug/valgrind-deadlock:
--24107-- confused by the above DIE
==24107== Thread 3:
--24107-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x9b
@vlovich
vlovich / main.rs
Created November 17, 2022 21:57
glommio deadlock under valgrind
use std::rc::Rc;
use futures_util::future::join_all;
use glommio::*;
#[derive(Copy, Clone, Debug)]
enum Message {
Ping,
Pong,
}
@vlovich
vlovich / bench.ts
Created May 27, 2022 17:53
Hacky R2 write IOPs benchmark
// "aws-sdk": "^2.1100.0",
import pkg from 'aws-sdk'
const { S3 } = pkg
import { performance } from 'perf_hooks'
import { globalAgent } from 'http'
import { globalAgent as globalAgentSecure } from 'https'
globalAgent.maxSockets = 300
globalAgentSecure.maxSockets = 300
@vlovich
vlovich / example.ts
Last active June 29, 2023 09:27
Example R2 worker to front a bucket
interface Env {
BUCKET: R2Bucket
}
function parseRange(encoded: string | null): undefined | { offset: number, length: number } {
if (encoded === null) {
return
}
const parts = encoded.split('-')
import asyncio
import sys
import time
def EXITED():
# Did app terminate
pass
class PatchableStderrStream(object):
def __init__(self):
@vlovich
vlovich / pybluez_build_failure.log
Created September 27, 2018 02:47
pybluez build failure
Building wheels for collected packages: pybluez
Running setup.py bdist_wheel for pybluez ... error
Complete output from command /opt/homebrew/bin/python3 -u -c "import setuptools, tokenize;__file__='/private/var/folders/yy/yxy91sxx7j9g2zjf6pg2ys4w00_w9p/T/pip-install-9vfvfafz/pybluez/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/yy/yxy91sxx7j9g2zjf6pg2ys4w00_w9p/T/pip-wheel-8ll3tuwd --python-tag cp37:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.13-x86_64-3.7
creating build/lib.macosx-10.13-x86_64-3.7/bluetooth
copying bluetooth/btcommon.py -> build/lib.macosx-10.13-x86_64-3.7/bluetooth