Skip to content

Instantly share code, notes, and snippets.

View johanrhodin's full-sized avatar

Johan Rhodin johanrhodin

View GitHub Profile
https://rachelbythebay.com/w/2016/02/21/malloc/
“They were very precise about it: 104.8 ºC,” says Prashant Jain, a chemist at the University of Illinois at Urbana–Champaign. “I was like, wait a minute, I know this temperature.”
Jain, a copper-sulfide specialist, remembered 104 ºC as the temperature at which Cu2S undergoes a phase transition. Below that temperature, the resistivity of air-exposed Cu2S drops dramatically — a signal almost identical to LK-99’s purported superconducting phase transition. “I was almost in disbelief that they missed it,” says Jain, who published a preprint7 on the important confounding effect.
from https://www.nature.com/articles/d41586-023-02585-7
Eventually make it into a blog post?
@johanrhodin
johanrhodin / rabbit_mgmt_external_stats
Created December 1, 2022 22:22
rabbit_mgmt_external_stats crashing
2022-12-01 19:55:08.626969+00:00 [debug] <0.21949.153> Plugins discovery: ignoring getopt, not a RabbitMQ plugin
2022-12-01 19:55:08.627487+00:00 [debug] <0.21949.153> Plugins discovery: ignoring quantile_estimator, not a RabbitMQ plugin
2022-12-01 19:55:08.663146+00:00 [error] <0.1226.146> ** Generic server rabbit_mgmt_external_stats terminating
2022-12-01 19:55:08.663146+00:00 [error] <0.1226.146> ** Last message in was emit_update
2022-12-01 19:55:08.663146+00:00 [error] <0.1226.146> ** When Server state == {state,1000000,
2022-12-01 19:55:08.663146+00:00 [error] <0.1226.146> [{{io_sync,count},9},
2022-12-01 19:55:08.663146+00:00 [error] <0.1226.146> {{io_file_handle_open_attempt,count},11},
2022-12-01 19:55:08.663146+00:00 [error] <0.1226.146> {{queue_index_read,count},5},
2022-12-01 19:55:08.663146+00:00 [error] <0.1226.146> {{msg_store_read,count},0},
2022-12-01 19:55:08.663146+
@johanrhodin
johanrhodin / osiris_offset_out_of_range.log.txt
Created September 9, 2022 19:51
Random issue with RabbitMQ Streams: badmatch,{error,einval} and offset_out_of_range
2022-09-09 19:35:30.047624+00:00 [debug] <0.11717.17> rabbit_stream_coordinator: running action: 'start_writer' for acqokxym_s1_1662752130037252903 on node 'rabbit@test-tall-wheat-goat-01' in epoch 1
2022-09-09 19:35:30.048177+00:00 [info] <0.18479.445> Stream: acqokxym_s1_1662752130037252903 will use /var/lib/rabbitmq/rabbit@test-tall-wheat-goat-01/stream/acqokxym_s1_1662752130037252903 for osiris log data directory
2022-09-09 19:35:30.048344+00:00 [info] <0.18478.445> rabbit_stream_coordinator: started writer acqokxym_s1_1662752130037252903 on 'rabbit@test-tall-wheat-goat-01' in 1
2022-09-09 19:35:30.048482+00:00 [debug] <0.18479.445> osiris_log:init/1 stream acqokxym_s1_1662752130037252903 max_segment_size_bytes: 1234,
2022-09-09 19:35:30.048482+00:00 [debug] <0.18479.445> max_segment_size_chunks 256000, retention [{max_bytes,1234}]
2022-09-09 19:35:30.049105+00:00 [debug] <0.18479.445> osiris_log: open_new_segment acqokxym_s1_1662752130037252903: 00000000000000000000.segment
2022-09-09 19:35:30
@johanrhodin
johanrhodin / left_over_connection.rb
Created April 25, 2022 20:38
Connection is left over when disk free alarm is in place
require 'amqp-client'
require 'dotenv/load'
NRM = 1
AMQPURL = ENV.fetch('CLOUDAMQP_URL')
conn = AMQP::Client.new(AMQPURL, connection_name:'leftover-connection').connect
ch = conn.channel
ch.confirm_select
@johanrhodin
johanrhodin / 38_logging
Created October 20, 2021 21:15
Difference in logging style between RabbitMQ 3.8 and 3.9
2021-10-20 15:15:44.302 [error] <0.1264.0> ** Generic server <0.1264.0> terminating
** Last message in was {'$gen_cast',init_shovel}
** When Server state == {state,undefined,undefined,undefined,undefined,{<<"/">>,<<"logslogslogs">>},dynamic,#{ack_mode => on_confirm,dest => #{current => {<0.1331.0>,<0.1416.0>,<<"amqps://log-srv.rmq.cloudamqp.com/destvhost">>},dest_exchange => <<"logs.hostname2">>,fields_fun => #Fun<rabbit_shovel_parameters.7.125748776>,module => rabbit_amqp091_shovel,props_fun => #Fun<rabbit_shovel_parameters.8.125748776>,resource_decl => #Fun<rabbit_shovel_parameters.6.125748776>,uris => ["amqps://hostname2:PASSWD@destserver.rmq.cloudamqp.com/destvhost"]},name => <<"logslogslogs">>,reconnect_delay => 5,shovel_type => dynamic,source => #{current => {<0.1269.0>,<0.1302.0>,<<"amqp://">>},delete_after => never,module => rabbit_amqp091_shovel,prefetch_count => 100,queue => <<"logslogslogs">>,resource_decl => #Fun<rabbit_shovel_parameters.10.125748776>,source_exchange_key => <<>>,uris => ["amqp://"
@johanrhodin
johanrhodin / shovel_overload
Last active September 13, 2021 17:42
Shovel issue were memory accumulates in connection writer and binaries.
# 1. On serverA Create a queue with 1M messages
bin/runjava com.rabbitmq.perf.PerfTest -y0 -p -u "q1" \
-s 1000 --id "q1" -ad false -f persistent \
-h $serverA \
-pmessages 1000000
# 2. On server B trigger the memory alarm.
sudo rabbitmqctl set_vm_memory_high_watermark 0
@johanrhodin
johanrhodin / Minimum Viable Federation
Last active October 13, 2021 21:05
A small examples showing a working queue federation
# Minimum Viable Federation
#Upstream servers are the servers towards messages are originally published
#Downstream servers are where the messages get forwarded to
# 1. Two clusters
DOWNSTREAM_URL="amqps://tynqsojc:PASSWD@test-server-1.rmq.cloudamqp.com/tynqsojc"
UPSTREAM_URL="amqps://prksmzye:PASSWD@test-server-2.rmq.cloudamqp.com/prksmzye"
VHOST=tynqsojc
HTTPS_DOWNSTREAM="https://tynqsojc:PASSWD@test-server-1.rmq.cloudamqp.com"
@johanrhodin
johanrhodin / pg2table.rb
Last active November 10, 2020 14:05
Fill up pg2table in RabbitMQ
#!/usr/bin/env ruby
require 'bunny'
require 'dotenv/load'
connection = Bunny.new ENV['CLOUDAMQP_URL3']
connection.start
channel = connection.create_channel # Declare a channel
for i in 1..1
puts "Creating queue #{i}"
@johanrhodin
johanrhodin / vhosts starting
Created May 8, 2020 04:04
Count vhosts that has started
bash << EOF
logpath=("/var/log/rabbitmq/rabbit@HOSTNAME.log")
numbervhosts=$(expr $(sudo rabbitmqctl list_vhosts | wc -l) - $num)
startnr=$(grep -n "Starting RabbitMQ" $logpath | tail -1 | cut -d : -f 1) # Last RabbitMQ Starting
startedvhosts=$(sed -n "$startnr"',$p' $logpath | grep -n "Starting message stores for vhost" | wc -l)
awk -v nvh="$numbervhosts" -v svh="$startedvhosts" 'BEGIN{ print int(svh/nvh*100) }'
EOF