{
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen.",
"segments": [
{
"start": 0.0,
"end": 4.72,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 4.72,
"end": 9.36,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 9.36,
"end": 15.44,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 15.44,
"end": 19.68,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 19.68,
"end": 22.88,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 22.88,
"end": 26.72,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 26.72,
"end": 28.0,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 28.0,
"end": 31.12,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 31.12,
"end": 33.8,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 33.8,
"end": 37.84,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 37.84,
"end": 40.24,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 40.24,
"end": 41.6,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 41.6,
"end": 43.68,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 43.68,
"end": 45.28,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 45.28,
"end": 46.92,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 46.92,
"end": 48.8,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 48.8,
"end": 52.76,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 52.76,
"end": 54.12,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 54.12,
"end": 57.02,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 57.02,
"end": 58.66,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 58.66,
"end": 60.66,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 60.66,
"end": 63.42,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 63.42,
"end": 66.66,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 66.66,
"end": 69.66,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 69.66,
"end": 71.18,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 71.18,
"end": 73.02,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 73.02,
"end": 74.38,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 74.38,
"end": 75.38,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 75.38,
"end": 77.86,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 77.86,
"end": 80.2,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 80.2,
"end": 84.24,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 84.24,
"end": 86.98,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 86.98,
"end": 89.94,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 89.94,
"end": 92.54,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 92.54,
"end": 95.3,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 95.3,
"end": 99.2,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 99.2,
"end": 100.94,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 100.94,
"end": 103.74,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 103.74,
"end": 106.62,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 106.62,
"end": 107.86,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 107.86,
"end": 110.92,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 110.92,
"end": 112.12,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 112.12,
"end": 114.84,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 114.84,
"end": 116.52,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 116.52,
"end": 119.44,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 119.44,
"end": 121.24,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 121.24,
"end": 123.2,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 123.2,
"end": 124.12,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 124.12,
"end": 128.04,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 128.04,
"end": 130.68,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 130.68,
"end": 132.64,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 132.64,
"end": 135.52,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 135.52,
"end": 138.14,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 138.14,
"end": 139.38,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 139.38,
"end": 141.94,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 141.94,
"end": 144.1,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 144.1,
"end": 145.42,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 145.42,
"end": 147.42,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 147.42,
"end": 149.9,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 149.9,
"end": 152.06,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 152.06,
"end": 153.18,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 153.18,
"end": 156.14,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 156.14,
"end": 159.3,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 159.3,
"end": 161.42,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 161.42,
"end": 163.22,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 163.22,
"end": 165.14,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 165.14,
"end": 167.7,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 167.7,
"end": 169.82,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 169.82,
"end": 170.82,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 170.82,
"end": 172.34,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 172.34,
"end": 173.62,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 173.62,
"end": 175.14,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 175.14,
"end": 176.98,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 176.98,
"end": 180.02,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 180.02,
"end": 183.22,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 183.22,
"end": 184.98,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 184.98,
"end": 186.9,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 186.9,
"end": 188.86,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 188.86,
"end": 190.78,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 190.78,
"end": 193.74,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 193.74,
"end": 196.18,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 196.18,
"end": 197.5,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 197.5,
"end": 198.98,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 198.98,
"end": 201.62,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 201.62,
"end": 203.3,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 203.3,
"end": 206.26,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 206.26,
"end": 208.3,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 208.3,
"end": 210.48,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 210.48,
"end": 212.1,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 212.1,
"end": 214.98,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 214.98,
"end": 217.82,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 217.82,
"end": 219.18,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 219.18,
"end": 220.02,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 220.02,
"end": 221.42,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 221.42,
"end": 222.74,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 222.74,
"end": 225.66,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 225.66,
"end": 227.62,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 227.62,
"end": 230.1,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 230.1,
"end": 231.42,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 231.42,
"end": 236.42,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 236.58,
"end": 239.94,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 239.94,
"end": 243.7,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 243.7,
"end": 246.06,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 246.06,
"end": 247.78,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 247.78,
"end": 249.58,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 249.58,
"end": 251.06,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 251.06,
"end": 253.18,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 253.18,
"end": 255.72,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 255.72,
"end": 258.86,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 258.86,
"end": 260.18,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 260.18,
"end": 262.26,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 262.26,
"end": 264.06,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 264.06,
"end": 265.18,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 265.18,
"end": 266.26,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 266.26,
"end": 267.9,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 267.9,
"end": 269.62,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 269.62,
"end": 271.34,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 271.34,
"end": 273.82,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 273.82,
"end": 276.5,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 276.5,
"end": 277.54,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 277.54,
"end": 280.26,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 280.26,
"end": 282.54,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 282.54,
"end": 284.86,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 284.86,
"end": 287.18,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 287.18,
"end": 289.82,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 289.82,
"end": 290.82,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 290.82,
"end": 292.98,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 292.98,
"end": 294.06,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 294.06,
"end": 295.94,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 295.94,
"end": 298.02,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 298.02,
"end": 299.5,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 299.5,
"end": 300.34,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 300.0,
"end": 306.16,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 306.16,
"end": 312.48,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 312.48,
"end": 317.68,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 317.68,
"end": 321.76,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 321.76,
"end": 325.84,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 325.84,
"end": 328.96,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 328.96,
"end": 331.24,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 331.24,
"end": 334.6,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 334.6,
"end": 336.2,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 336.2,
"end": 337.32,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 337.32,
"end": 339.4,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 339.4,
"end": 341.1,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 341.1,
"end": 343.08,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 343.08,
"end": 344.56,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 344.56,
"end": 347.84000000000003,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 347.84000000000003,
"end": 350.4,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 350.4,
"end": 352.88,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 352.88,
"end": 354.76,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 354.76,
"end": 357.0,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 357.0,
"end": 358.36,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 358.36,
"end": 360.64,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 360.64,
"end": 363.52,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 363.52,
"end": 365.56,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 365.56,
"end": 366.56,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 366.56,
"end": 368.64,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 368.64,
"end": 370.8,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 370.8,
"end": 372.0,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 372.0,
"end": 375.36,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 375.36,
"end": 376.48,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 376.48,
"end": 379.2,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 379.2,
"end": 382.2,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 382.2,
"end": 385.72,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 385.72,
"end": 389.84000000000003,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 389.84000000000003,
"end": 391.32,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 391.32,
"end": 392.96,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 392.96,
"end": 395.56,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 395.56,
"end": 397.15999999999997,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 397.15999999999997,
"end": 398.0,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 398.0,
"end": 399.12,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 399.12,
"end": 400.88,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 400.88,
"end": 402.64,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 402.64,
"end": 404.04,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 404.04,
"end": 407.92,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 407.92,
"end": 410.44,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 410.44,
"end": 412.48,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 412.48,
"end": 415.8,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 415.8,
"end": 416.72,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 416.72,
"end": 418.08,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 418.08,
"end": 420.86,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 420.86,
"end": 422.76,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 422.76,
"end": 424.52,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 424.52,
"end": 426.4,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 426.4,
"end": 428.28,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 428.28,
"end": 429.08000000000004,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 429.08000000000004,
"end": 431.96000000000004,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 431.96000000000004,
"end": 434.32,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 434.32,
"end": 437.56,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 437.56,
"end": 439.6,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 439.6,
"end": 441.32,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 441.32,
"end": 443.32,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 443.32,
"end": 444.52,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 444.52,
"end": 446.4,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 446.4,
"end": 447.48,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 447.48,
"end": 449.03999999999996,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 449.03999999999996,
"end": 451.4,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 451.4,
"end": 454.08000000000004,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 454.08000000000004,
"end": 455.44,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 455.44,
"end": 456.91999999999996,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 456.91999999999996,
"end": 459.68,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 459.68,
"end": 461.68,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 461.68,
"end": 463.28,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 463.28,
"end": 466.03999999999996,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 466.03999999999996,
"end": 469.36,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 469.36,
"end": 471.32,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 471.32,
"end": 473.96000000000004,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 473.96000000000004,
"end": 476.28,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 476.28,
"end": 479.96000000000004,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 479.96000000000004,
"end": 483.24,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 483.24,
"end": 487.56,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 487.56,
"end": 488.8,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 488.8,
"end": 491.38,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 491.38,
"end": 493.44,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 493.44,
"end": 495.86,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 495.86,
"end": 497.15999999999997,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 497.15999999999997,
"end": 499.44,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 499.44,
"end": 501.64,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 501.64,
"end": 503.64,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 503.64,
"end": 506.64,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 506.64,
"end": 509.24,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 509.24,
"end": 510.68,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 510.68,
"end": 513.88,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 513.88,
"end": 515.52,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 515.52,
"end": 518.8,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 518.8,
"end": 519.84,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 519.84,
"end": 520.8,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 520.8,
"end": 522.36,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 522.36,
"end": 524.6,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 524.6,
"end": 528.0,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 528.0,
"end": 529.16,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 529.16,
"end": 531.56,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 531.56,
"end": 534.16,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 534.16,
"end": 537.88,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 537.88,
"end": 539.64,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 539.64,
"end": 542.12,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 542.12,
"end": 543.76,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 543.76,
"end": 548.4,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 548.4,
"end": 551.56,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 551.56,
"end": 554.48,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 554.48,
"end": 556.44,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 556.44,
"end": 559.56,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 559.56,
"end": 561.24,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 561.24,
"end": 564.28,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 564.28,
"end": 566.8399999999999,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 566.8399999999999,
"end": 568.56,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 568.56,
"end": 570.8399999999999,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 570.8399999999999,
"end": 573.6,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 573.6,
"end": 575.8,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 576.64,
"end": 578.88,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 578.88,
"end": 580.6,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 580.6,
"end": 584.12,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 584.12,
"end": 586.52,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 586.52,
"end": 590.0799999999999,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 590.0799999999999,
"end": 592.12,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 592.12,
"end": 593.8399999999999,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 593.8399999999999,
"end": 595.48,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 595.48,
"end": 598.48,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 598.48,
"end": 600.2,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 600.0,
"end": 602.34,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 602.34,
"end": 604.04,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 604.04,
"end": 605.4,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 605.4,
"end": 607.22,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 607.22,
"end": 611.84,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 611.84,
"end": 614.08,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 614.08,
"end": 618.56,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
},
{
"start": 618.56,
"end": 623.43,
"text": "There's an entire classification of bugs that you can just understand what they are, simply by the conditions. Let me give you a perfect example. If you have a bug, then you put in a console.log statement and then the bug disappears. You should immediately know this is a timing-based bug. The cost of actually printing slowed things down enough, then now the bug no longer happens. And then when you delete the print statement, what happens? The bug comes right back. This is the most famous one. It's actually she called a hyzen bug. A hyzen bug is a software bug that seems to disappear or alter its behavior when one attempts to study it. So simply observing this bug will cause it to go away. And typically you just know that this involves time. Now there's another set of bugs that if I even just say a number, there will be some of you out there that will just break out and sweat. So, okay, brace yourselves. 49 days, 17 hours, two minutes and 47 seconds. Now I know most of you are like, I don't even know what you're saying to me. Well, hopefully by the end of this video, you will also get sweaty too because it is a horrible, horrible number and you should know exactly what the problem is immediately. But before we begin, hey, gotta make that bag, baby. I know a lot of you have agents and you're letting them run around on the internet on your computer. Stop it. That's the easiest way to shoot yourself in the foot. This is why you need today's video sponsor, kernel.sh, the crazy fast and open source infra for your AI agents to access the internet. It takes under 30 milliseconds to spin up one or 1,000 cloud browsers for your agents and authentication is automatically handled. Right now over 3,000 teams already use this in production including Framer and Cash App. So quit nerfing your agents and give them a real browser. Head on over to kernel.sh and let them use the internet. ALL right, welcome back. Well, I would love to show you this really sweet document that we have right here, but unfortunately they just recently changed their website which caused ALL the text to turn white and even when I go in there and manually adjust the CSS, it just refuses not to be white. So I have the readers open right here. The article is called, We Found a Ticking Time Bomb in Mac OS TCP Networking. It detonates after exactly 49 days. And this involves a company called Photon in which has a fleet of Macs they use to monitor the iMessenger service. And for whatever reason, the Macs just crash after 49 days, 17 hours, two minutes and 47 seconds. Every single time they just start, also just start running out of control with memory. And then eventually they can no longer make any new TCP connections. That's kind of weird, right? And it turns out this is a bug that's actually in ALL Macs. If you just let a Mac stay on longer than 49 days, 17 hours, two minutes and 47 seconds, you will start experiencing the same problem. You make enough TCP connections and ALL of a sudden you will be able to make no more and your computer will effectively be bricks. ALL right, to understand this, you first need to understand the basics of making a TCP connection. When you make a TCP connection from your computer to some server, by the way, look at that beauty of a line, hand drawn, artisanal straightness. Never thought I could even tell that to my mom. So with this in mind, when you go and you make a connection, you actually use a port on your machine. You have about 65,000 ports on your machine, but you only use approximately half of them for making these connections. When you close the connection, that port isn't immediately useful again. It needs to wait a small amount of time because remember, the internet's big, stuff happens. Packets that were sent out from the server could go bounce around on the cloud for a while and then come shoot into your computer. So if you just immediately reuse that port, you could get some other connections packet coming in, completely confuse the whole thing, completely corrupt it and then that actual connection would be completely useless. I just said the word completely like three times in a row. So there's this thing called time wait. It's always usually specified in big capital letters, time wait. It's actually from the old RFC from 1981, seven, nine, three. Now, if you've kept up with any of my content, you know, this is kind of a B tier RFC because I did rank ALL of the RFCs. And this one, you know, it's pretty good. Of course I had to take down the video later. Everybody knows why, you know, of the controversy, I don't really want to talk about it. Anywho, so whenever you use a connection, that port will be held for about an additional 30 seconds. And then after those 30 seconds, hey, you're free to be used again, bud. The second important thing you need to know is integer overflows. I'm sure most of you know, but in case some of you who don't, let me do a quick explanation. A byte contains eight bits. Let's pretend ALL eight bits are ones. If I were to add one, one to this, what would end up happening? Well, this would go to zero, you'd carry the one. This would go to zero, you'd carry the one. Dot, dot, dot, dot, ALL the way to the end, you'd carry the one, this would be a zero, you'd carry the one, and then the overflow bit would be set to one. By the way, that was a vertical straight line, super rare. Okay guys, this is a good video. This is a, you better say something about how good this line looks, okay? I expect.\nAnd that means your value went from 255, the maximum size of an unsigned byte, can be ALL the way down to zero. Very sad day. And this is called an integer overflow. You go ALL the way up to the maximum value, just to be put ALL the way back at the beginning. And if I could really try very hard, I think I could make this drawing even better. Keep that in. Okay, so now that you know those two very important pieces of information, What Photon ended up doing is setting up an experiment. The experiment was, okay, we're gonna take a Mac that's just about to run out of life, right? It's just about to cross this line or they ALL keep crashing. And what we're gonna do is about five minutes before the time, we're just gonna start sending massive amounts of client connections. And what we should see internally is that we reach an equilibrium of ports taken where every time we make a new request, one of the old ones after 30 seconds should be dropped. And that's exactly what they have right here. Again, sorry for the text just not shown up. But right here you can see they get up to about 200 active connections. And so the connections just keep being made over and over again and new connections start opening up after 30 seconds. But as they approach that number, if you look right here you'll see that the connections start gaining and gaining and gaining. What's effectively happening is that no new connections are being made. And the reason why is actually kind of surprising. So if you jump over here to the old Apple OSS dash distribution slash XNU, you will find the actual Apple like XNU distribution. This is what's on side of your Mac. You can go and you can check out stuff. You can go check out what's going on with security, man, or maybe you can look at the Apple license. I don't know. Oh gosh, don't show this. Oh man, Apple, that's a lot of license. This doesn't look like MIT to me. What the heck's happening here? Anyways, if you go to tcp underscore sub R dash C, you will find this beautiful little function right here called Calculate TCP Clock. Now, this is used to kind of keep the entire TCP packets and everything in sync, because whenever you send out a packet, they have some timing information associated with it. Of course, this is also used to know when, hey, has that passed? Therefore, can we free up this port? They use this one singular clock. If you look right here, this is how they get the current time in milliseconds. Now, if you're used to something like date.now or you use odin, you use like tick underscore now, you'd be like, what the heck is going on here? Well, this is the old fashioned way of being able to get timing information. It actually looks a lot like the Chrome Performance APIs, doesn't it? Yes, it does. And if you look at this line right here, this is where the bug starts. Now, you'll notice that it takes the TV seconds. I don't know what TV stands for, but just go with it. It takes the amount of seconds that has passed since your machine has started up and multiplies it by a thousand, which effectively makes it into milliseconds. Then it casts it into a Uint32. Now, what's the problem with UN32? Well, there's about 4.2 billion values that can be represented by a UN32. Seconds multiplied by a thousand turn into milliseconds and about 4.2 billion milliseconds is approximately 49 days, 17 hours, two minutes and 47 seconds. Therefore, once you've reached this point, this thing rolls over and where does it go? It goes ALL the way back down to zero. Now that it's back down to zero, we get the current TCP now, which is just gonna be some low value once you cross that threshold. Then what it does is it loads the shared timestamp among ALL the TCP things going on. This temp, it goes and it checks, it says, hey, is the temporary time currently less than the now time? Oh, it is, we're gonna update that time now. Well, what's the problem right here? What happens right here? What's going on right here? Well, current now just wrapped ALL the way around. It's some small value, like 5,000, 1,000, 500, who knows what it is. Either way, it's a small value. Therefore, this statement will never execute. Therefore, the time internally in ALL the TCP stack will never move forward. Therefore, I've said that word too many times, but just deal with it again. Therefore, time wait can never be exceeded that 30 seconds. That means that none of the old ports can be freed, which means that once you've made too many connections, After like what, 32,000 connections, you can no longer make any new connections. Any of your currently open connections, of course they work, but any new TCP connections do not work at ALL anymore. Oh my gosh, look at this. And it's ALL because of this, UINT32. You, hey, you wanted to save four bytes of data instead of going to a 64-bit number. Causing problems for everybody. In fact, this is actually the exact, effectively the exact same problem of Y2K38. It's the exact same thing, except for Y2K38, it's the amount of seconds from 1970 up until the number will start rolling over and going back into the past. Because they use an I32, so they only get 2.1 billion seconds, and that is about, you know, 20.\nAnyway, I just thought this was super interesting. This is like such a super cool bug. You should definitely go check it out. The actual article is fantastic. If you can read it, it really goes into some good depth and ah that was just I just find this stuff just absolutely fascinating. So if you've ever kept a Mac on for too long and then everything breaks, well, this is exactly the reason why the name is the primogen."
}
],
"language": "en-US",
"source": "whisper_chunked_parallel",
"model": "small"
}