I'm a student fairly new to physics, and I was working through a textbook (this is not for homework) when I came across a problem involving
Two masses, $m$ and $2m$, hang over a pulley with mass $m$ and radius $R$ (and $I = \frac{mR^2}{2}$), as shown. Assuming that the (massless) string doesn’t slip on the pulley, find the accelerations of the masses.
I was able to deduce on my own that there must be a net torque on the pulley, for it to accelerate along with the string of the pulley. I believe this also implies a static friction force between the string and the pulley, for the torque to be applied from the string to the pulley, and prevent slipping of the string.
However, the next natural assumption this led me to is that the string must have different tensions throughout itself. But, everything I read in the book, and online, has told me that massless strings must have a constant tension throughout (which I understand, using the argument that a small piece of string cannot have net force, as that would yield infinite acceleration). However, everywhere I read online implies that this is an absolute rule $-$ several forums, including discussions on Stack Exchange seem to imply that a massless string has zero acceleration, regardless of the setup. I understand why the deduction about the net torque on the pulley leads to the result that the string must have different tensions throughout itself, but can't intuitively grasp how such a massless string can exist.
I was slightly illuminated by this Wikipedia article, which states that a massless string only has uniform tension if the string has no bends (i.e. it is perfectly straight). However, I can't convince myself of this fact, and would like help (an explanation) for why this is true $-$ in particular, why can't we just, once again, use the argument where we consider a piece of the massless string, and show the tensions on either side of it, along the string, must be equal to prevent infinite acceleration? Another reason I'm not fully convinced that bending a massless string allows it to exist with non-constant tension is that in problems with a massless pulley and a massless string, the string having non-constant tension is never possible, even though it's bent around the pulley.
Though I found a post on Stack Exchange with a nearly identical question from 11 years ago, it was never really resolved. The textbook's solution does not address this, but it mentions that the accelerations of the two masses are equal, despite it also saying that the tensions on either side of the pulley are different, which confuses me even more.
I would really like to understand why a massless string can exist with varying tensions along its body in such a setup, as well as why such a setup can coexist with the masses on either side of the pulley having equal accelerations.
Thanks!