python / cpython

The Python programming language
https://www.python.org
Other
63.2k stars 30.26k forks source link

ftplib crash #34707

Closed 50eff062-408a-4098-b1b2-8222303b9d0c closed 23 years ago

50eff062-408a-4098-b1b2-8222303b9d0c commented 23 years ago
BPO 438931
Nosy @gvanrossum, @loewis

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields: ```python assignee = None closed_at = created_at = labels = ['invalid', 'library'] title = 'ftplib crash' updated_at = user = 'https://bugs.python.org/anonymous' ``` bugs.python.org fields: ```python activity = actor = 'gvanrossum' assignee = 'none' closed = True closed_date = None closer = None components = ['Library (Lib)'] creation = creator = 'anonymous' dependencies = [] files = [] hgrepos = [] issue_num = 438931 keywords = [] message_count = 3.0 messages = ['5297', '5298', '5299'] nosy_count = 2.0 nosy_names = ['gvanrossum', 'loewis'] pr_nums = [] priority = 'normal' resolution = 'not a bug' stage = None status = 'closed' superseder = None type = None url = 'https://bugs.python.org/issue438931' versions = [] ```

3772858d-27d8-44b0-a664-d68674859f36 commented 23 years ago

I've found a rather horrible problem when using ftplib. I'm running python2.1 and linux kernel 2.4.4

I haven't had a chance to check this out on any other machines, I don't want to bring down a server testing this.

This code makes my system hang when I try to upload a file of 4 megs or 100 megs. It works for 22 bytes (my other test file):

def copyDepot(self, depot):
        import ftplib, stat
        depot.mFullPath = "/tmp/" + depot.mFile
        ftp = ftplib.FTP(self.mHost)
        ftp.login(self.mUser,self.mPass)
        f = open(depot.mLocalPath, 'r+')
        ftp.storbinary("STOR " + depot.mFullPath, f, 8192)
        size = ftp.size(depot.mFullPath)
        lsize = os.stat(depot.mLocalPath)[stat.ST_SIZE]
        ftp.quit()
        print "Remote Size: ",size
        print "Local Size: ",lsize
        if size != os.stat(depot.mLocalPath)[stat.ST_SIZE]:
            raise "Size does not match!"

Any ideas? Has anybody heard of something like this happening? What would you suggest I do to fix it if its not python?

61337411-43fc-4a9c-b8d5-4060aede66d0 commented 23 years ago

Logged In: YES user_id=21627

Can you analyze in more detail as to how exactly the two files differ (e.g. finding a byte offset and a few bytes around the first difference)?

gvanrossum commented 23 years ago

Logged In: YES user_id=6380

Haven't heard back in over a month. Closing this now.

I suspect this was a case of binary vs. text mode on either the client or the server.

Notice that the code uses mode 'r+' which doesn't make sense, suggesting a newbie at work.