[issue19337] MMAP: Bus error (core dump) under heavy read/write

2013-10-21 Thread Ribhi Kamal

Changes by Ribhi Kamal :


Removed file: http://bugs.python.org/file32285/core.gz

___
Python tracker 
<http://bugs.python.org/issue19337>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19337] MMAP: Bus error (core dump) under heavy read/write

2013-10-21 Thread Ribhi Kamal

Changes by Ribhi Kamal :


--
status: open -> closed

___
Python tracker 
<http://bugs.python.org/issue19337>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19337] MMAP: Bus error (core dump) under heavy read/write

2013-10-21 Thread Ribhi Kamal

Ribhi Kamal added the comment:

I figured I was doing something wrong... sorry about that

--
components:  -Library (Lib)
resolution: invalid -> 
status: closed -> open
versions:  -Python 3.3, Python 3.4

___
Python tracker 
<http://bugs.python.org/issue19337>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19337] MMAP: Bus error (core dump) under heavy read/write

2013-10-21 Thread Ribhi Kamal

Ribhi Kamal added the comment:

Code dump attached

--
Added file: http://bugs.python.org/file32285/core.gz

___
Python tracker 
<http://bugs.python.org/issue19337>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19337] MMAP: Bus error (core dump) under heavy read/write

2013-10-21 Thread Ribhi Kamal

New submission from Ribhi Kamal:

I was about to use memory mapping for something when I discovered that the code 
example posted on python.org causes python to core dump. %100 reproducible

The steps are really simple. 
1- Create a file and map it using mmap.mmap
2- In a while loop, contintously read the file
3- From another process, like bash, continuously write to the file.

After about 5 iterations from the reader, python core dumps.

Reader code (python):
#!/usr/bin/python2.7

import mmap
import time

with open("hello.txt", "wb") as f:
f.write("Hello Python! 1234123412341234\n")

with open("hello.txt", "r+b") as f:
# memory-map the file, size 0 means whole file
mm = mmap.mmap(f.fileno(), 0)
count=0
while count < 100:
   mm.seek(0)
   print mm.readline()
   time.sleep(0.1)
   count = count + 1

# close the map
mm.close()


Writer code (linux shell/bash):
#!/bin/bash
count=0
while true
do
 ((count++))
 echo $count > hello.txt
done


Now run the reader, then launch the writer in a terminal. In my case I get the 
following output:
>110
>
>462
>
>Bus error (core dumped)


Python 2.7.3
Linux 3.2.0-54-generic #82-Ubuntu SMP Tue Sep 10 20:09:12 UTC 2013 i686 i686 
i386 GNU/Linux
Ubuntu 12.04.3 LTS
Intel(R) Core(TM)2 CPU  6300  @ 1.86GHz

--
components: IO
messages: 200820
nosy: rbhkamal
priority: normal
severity: normal
status: open
title: MMAP: Bus error (core dump) under heavy read/write
type: crash
versions: Python 2.7

___
Python tracker 
<http://bugs.python.org/issue19337>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com