Connection Reset Issue with Memcached Service on Railway

amyat103
PRO

8 months ago

Hello,

I’m running into a weird issue with my Memcached instance on Railway, and I’m hoping someone here might have a clue about what’s going on.

I can connect to Memcached just fine, and I’m even able to run a set command without any problems. But as soon as I try to get the value back, the connection resets every time with this error:

ConnectionResetError: [Errno 54] Connection reset by peer

I’ve tried both pymemcache and python-memcached, even tweaking the timeout settings, but no luck.

snippet of my test code

from pymemcache.client.base import Client

client = Client(('roundhouse.proxy.rlwy.net', 57907), timeout=10, connect_timeout=10)

try:

client.set('test_key', 'hello world', expire=60)

value = client.get('test_key')

print("Retrieved value:", value) # Expected output: "hello world"

except Exception as e:

print("Error during set/get:", e)

finally:

client.close()

Output:

True

Connection reset. Retrying...

True

Connection reset. Retrying...

True

Connection reset. Retrying...

>>>

Does anyone know if this could be tied to connection limits or specific settings for Memcached on Railway

1 Replies

8 months ago

Are your item sizes larger than 32mb?

And please make sure you are using the private host and port instead of the public host and port.