Skip to content

Instantly share code, notes, and snippets.

@bert-w
bert-w / README.md
Created October 27, 2026 18:10
Laravel Octane: a worker keeps a request's memory after the request ends (reproduction)

Laravel Octane: a worker keeps a request's memory after the request ends

bash reproduce.sh creates a fresh Laravel app with Octane on FrankenPHP (one worker) and adds a route that keeps ~200 MB of small strings on the request, the way request()->json() keeps a decoded body. It then prints the container's memory around one request to that route: first on the latest Octane release, then on the PR branch with ReleaseFreedMemory enabled.

Needs Docker and curl. It creates ./octane-repro (the container writes some files there as root) and uses port 8000.

Laravel 13.39.0, FrankenPHP 1.13.4, PHP 8.5.12:

Container memory Warm After /payload After 1 more request After 20 more requests
@bert-w
bert-w / app\Console\Commands\RepeatCommand.php
Created May 30, 2023 20:29
Repeat Laravel commands every (few) second(s)
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Artisan;
class RepeatCommand extends Command
{
protected $signature = 'repeat-command
@bert-w
bert-w / bricklink-mod.user.js
Last active October 8, 2020 11:50
BrickLinkMod
@bert-w
bert-w / search.php
Created March 21, 2019 22:05
Find a high multiplicative persistence in PHP
<?php
// INPUT VARS
$start = 2677889;
$end = 26888999;
/**
* @param integer $input
* @return false|int
*/
@bert-w
bert-w / .htaccess
Last active May 17, 2019 22:05
Generic htaccess rewrite to HTTPS
# Rewrite non-https to https + www
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://www.%1%{REQUEST_URI} [L,NE,R=301]
</IfModule>
# Rewrite non-https to https without www
@bert-w
bert-w / helpers.scss
Last active June 30, 2017 13:07
SCSS/SASS helpers for padding & margin classes
$type: (p:padding, m:margin);
$position: (t:top, l:left, b:bottom, r:right);
$range: 0 5 10 15 20 25 30 35 40;
/*
* Loop and create classes that serve as quick padding/margin modifiers.
* Explanation of class syntax:
*
* ".p-t-0" Assign a padding-top of 0px (!important).
* ".m-b-35" Assign a margin-bottom of 35px (!important).