Medieval sieges had two components to them:
Starve them out. We're talking medieval technologies, so farming isn't anywhere what it is today...more land was needed to feed people. If there was an ability to gain food and water during a siege by the defender, this becomes a pretty useless tactic honestly. As an extension to this, there is little to prevent a sieging army to try to instill disease (dead cow corpses thrown over)...medieval medicine wasn't much and combination of starvation and disease always takes it's toll. This also includes weapons and ammunition...constant battle from the walls requires a lot of ammo after all. Lets not forget the resources required to repair and maintain the walls as well. This city needs more than just food and water...fuel and materials for ammo and repairs and new weapons etc. All are required and failing in any of them can let a besieging army take the city
Storm the castle. During the siege, the city walls are under constant bombardment. Trebuchets can hurl stones an incredible distance and although they aren't much one at a time, they do eventually wear walls and defenders down. Arrow fire can also slowly whittle down defenders...a wounded defender won't find the time to heal and poor food/water supplies often means a small wound becomes an infected death sentence. The slowly whittled down defenders only need to leave one opening and a opportunistic sieging army is in their city, let the storming begin! (The list link you provided had 2 good examples...Russians were sieging a monastery that had local support and constant resupply, but a traitor showed them a window they could enter and the monastery fell. The siege of Xiangyang ended after 6 years when a test shot from a trebuchet hit a stone bridge...bridge crumbled, nothing special, but the populace panicked and opened the gate in an attempt to flee. Mongols entered the now open gate. Pro-longed sieges were often a search for a single opportunity and it only takes one).
There is usually a balance that prevents long long term sieges...a large population is capable of fully defending the walls and keeping the invaders out, but consume more resources and shorten the time that they can hide behind walls. A smaller force will consume less resources and hold out for longer, but they risk not being able to defend the walls fully due to lack of man power.
The part that is hard to say is how inept your sieging army is...an army proficient in siege tactics, has the resources, and enough of an established supply chain to put up an aggressive siege should eventually be able to drop any defender. Launching diseased bodies (cows and people) into the city will spread disease (lack of food and water compounds this). Devices like the Lithobolos hurled a baseball sized stone...it's never intended to take down a wall, but 3 or 4 of these devices can make the defending army think twice about manning the walls (they pick off defending archers well). Add in some trebuchets to damage the infrastructure behind the wall, mass archers to kill anything the Lithbolos miss on the walls, and build a massive ass ramp to march over the wall with. Let disease take it's toll and the population suffer for a while, and march over the walls. Oh, and don't forget to poison the water sources entering the city as much as possible (dumping sewage upstream is another ugly tactic to cause disease).
You have to ask what the invading army is going to gain from taking the city. Is it valuable enough to dedicate the resources to fully take, or is it pointless (horrid cost to gain ratio) to fully capture and a simple blockade style siege effectively negates the enemy city and there is no need to go any further?
There's quite a few external factors to consider as well. Wars don't last centuries very often and resources are ultimately scarce. Can your besieging army maintain it's resources and position in the world for decades (most empires don't last as long as this siege)? Will it not be needed elsewhere? Will an ally or simply a power trying to maintain the balance of power try to lift the siege?
So you have two sides...I believe a properly equipped and motivated sieging army could take any city through a variety of methods. The Romans proved this true repeatedly, successfully taking cities using a combination of their vast resources and ingenious engineering skills. A less motivated/engineering savvy besieging army and a defender with near infinite resources could hold out for many decades and potentially forever.
Just a side note...but the castles proximity to the sea and access to resupply via ship is a very consistent theme of the pro-longed sieges. It's actually somewhat hard to resupply via land...the weight of supplies involved and the travel distance over land limits what can be effectively resupplied. Via ship is different and a lot of supplies can come in just one ship load. Even if it is blockaded, a fleet can momentarily interupt the blockade, allow a bunch of supply ships through, and then flee (supply ships in this case get scuttled for the wood after they are unloaded)
2nd edit (Pavel's comment inspired):
The defending castles setup and positioning can make a difference here. If there was a natural terrain feature such as a body of water or mountain (perhaps the city is in a valley with two of it's side effectively defended by the terrain) then the number of defending soldiers required to fully man the walls drops. Less soldiers is less of a drain on the cities supplies and they will be able to last longer.