Memory Malfeasance – Derick Rethans

Memory Malfeasance

A while ago I started getting weird crashes on my desktop machine — Gargleblaster. Once in a while, PHP, or Node, would crash. And browser tabs kept turning blank, with Firefox crashing altogether once in a while too.

At first I thought there was some memory corruption in a system library, but neither valgrind or GDB would show any issues — if the problem could be reproduced at all. It was also very random, but the problem went away for a short while after a reboot.

I suspected the worst: Broken memory.

In the past I had used tools like memtest86, and memtest86+ — both available as packages on my Debian system. There are some complications with both of these on newer UEFI BIOS systems. This meant that when I tried them, the system would not even boot. A new version of memtest86+ was supposed to fix this, but that did not work either for me.

I decided to live with it for a while, but after another total loss of tabs (oh dear!), I stumbled upon a different tool: PCMemTest. This did boot, but their documentation page says “The UHCI USB controller is not yet supported”, which is needed for USB keyboards.

I was happily surprised that Debian’s APT repository also included a package for this memory testing tool. After I installed it, I rebooted my machine to see what it would say. The result:

PCMemTest showing broken memory

PCMemTest allows you to create a configuration line for the Grub configuration which the Linux kernel uses while booting up to exclude certainly parts of physical memory from being used. However, without the USB keyboard working, I could not not navigate to that feature.

Then I read that the kernel itself also has a memory test tool built in: the memtest kernel parameter.

To include the memory test when the system boots, update the GRUB_CMDLINE_LINUX_DEFAULT line in /etc/default/grub to:

GRUB_CMDLINE_LINUX_DEFAULT="quiet pcie_aspm=off memtest=4" 

And then run update-grub.

Now when the system starts, the kernel will run a memory test and automatically exclude any memory that it finds not working.

On my system this looks in the dmesg output like:

[ 0.000000] early_memtest: # of tests: 4
[ 0.000000] 0x0000000000100000 - 0x0000000001000000 pattern aaaaaaaaaaaaaaaa
[ 0.000000] 0x0000000001020000 - 0x0000000004000000 pattern aaaaaaaaaaaaaaaa
[ 0.000000] 0x000000000401e000 - 0x0000000009df0000 pattern aaaaaaaaaaaaaaaa
[ 0.000000] 0x0000000100000000 - 0x0000000180000000 pattern 5555555555555555
[ 0.000000] ------------[ cut here ]------------
[ 0.000000] Bad RAM detected. Use memtest86+ to perform a thorough test and the memmap= parameter to reserve the bad areas.
[ 0.000000] 5555555555555555 bad mem addr 0x000000016dbc8450 - 0x000000016dbc8458 reserved
[ 0.000000] 0x000000016dbc8458 - 0x0000000180000000 pattern 5555555555555555
[ 0.000000] 0x0000000180410000 - 0x0000000727200000 pattern 5555555555555555
[ 0.000000] 0x000000072980d000 - 0x000000107f300000 pattern 5555555555555555
[ 0.000000] 0x0000000000100000 - 0x0000000001000000 pattern ffffffffffffffff
[ 0.000000] 0x000000072980d000 - 0x000000107f300000 pattern 0000000000000000 

The line bad mem addr 0x000000016dbc8450 - 0x000000016dbc8458 reserved is saying that the kernel excluded that section of memory because it found it to be broken.

Since I booted my system 16 days ago, I have no longer seen any unexplained crashes. Yay!

At some point I will need to replace this memory, if I find out which of the four memory modules it is. That is a job for some other time.

Breaking RSS Links – Jordi Boggiano

Sorry for the spam but I’m about to break links on the internet and I feel bad.

I am finally ready to migrate away from my home-grown-CMS-built-in-2007 to a static site generator, and while I can keep most things running the feed URLs will just have to go.

If you happen to be still be using RSS (high five fellow old person), and also subscribed to this blog, please update your subscription URL to:

PHP Internals News: Episode 100: Sealed Classes – Derick Rethans

PHP Internals News: Episode 100: Sealed Classes

In this episode of “PHP Internals News” I talk with Saif Eddin Gmati (Website, Twitter, GitHub) about the “Sealed Classes” RFC that he has proposed.

The RSS feed for this podcast is, you can download this episode’s MP3 file, and it’s available on Spotify and iTunes. There is a dedicated website:


Derick Rethans 0:14

Hi, I’m Derick. Welcome to PHP internals news, the podcast dedicated to explaining the latest developments in the PHP language. This is episode 100. Today I’m talking with Saif Eddin Gmati about the sealed classes RFC that they’re proposing. Saif, would you please introduce yourself?

Saif Eddin Gmati 0:31

Hello, my name is Saif Eddin Gmati. I work as a Senior programmer at I’m an open source enthusiast and contributor.

Derick Rethans 0:39

Let’s dive straight into this RFC. What is the problem that you’re trying to solve with it?

Saif Eddin Gmati 0:43

Sealed classes just like enums and tagged unions allow developers to define their data models in a way where invalid state becomes less likely. It also eliminates the need to handle unknown subtypes for a specific model, as using sealed classes to define models gives us an idea on what child types would be available at run time. Sealing also provides us with a way for restricting inheritance or the use of a specific trait. For example, if we look at logger trait from the PSR log package that could be sealed to logger interface. This way, we ensure that every use of this trait is coming from a logger not from any other class.

Derick Rethans 1:24

I’m just reading through this RFC tomorrow, again, and something I didn’t pick up on reading to it last time. It states that PHP already has sort of two sealed classes.

Unknown Speaker 1:35

Yes, the throwable class in PHP can only be implemented by extending either error or exception. The same applies for DateTime interface, which can only be implemented by extending DateTime class or DateTime Immutable class.

Derick Rethans 1:52

Because PHP itself doesn’t allow you to implement either throwable or DateTimeInterface. I haven’t quite realized that that these are also sealed classes really. What is sort of the motivation behind wanting to introduce sealed classes?

Unknown Speaker 2:06

The main motivation for this feature comes from Hack the programming language. Hack contains a lot of interesting type concepts that I think personally, PHP could benefit from and sealed classes is one of those concepts.

Derick Rethans 2:18

What kind of syntax are you proposing?

Saif Eddin Gmati 2:21

The syntax I’m proposing actually there is three syntax options for the RFC currently, but the main syntax is inspired by both Hack and Java. It’s more similar to the syntax used in Java as Hack uses attributes. Personally, I have been I guess, using attributes from the start as I personally see sealing and finalizing similar as both effects how inheritance work for a specific class. Having sealed implemented as an attribute while final uses a keyword brings more inconsistency into the language which is why I have decided not to include attributes as a syntax option.

Derick Rethans 2:56

In my opinion, attributes shouldn’t be used for any kind of syntax things. What they s

Truncated by Planet PHP, read more at the original (another 13608 bytes)

Run Laravel 9 on Docker in 2022 [Tutorial Part 4.3] – Pascal Landau

In this third subpart of the fourth part of this tutorial series on developing PHP on Docker we will
install Laravel and make sure our setup works for Artisan Commands, a Redis Queue and Controllers
for the front end requests.