6 Replies Latest reply on Oct 1, 2009 10:20 AM by youplaboom

    Asynchronous stream write seg fault

    emuller

      I'm passing a memory pointer created by Python (numpy array) to a asynchronous stream write ( stream.write(python_ptr, "async") ) and it is causing segfault, while the same write in synchronous mode is not causing a seg fault.  Therefore, I assume there are restrictions on destination memory pointers for asynchronous writes.  Anybody know what they are?

       

       

       

       

        • Asynchronous stream write seg fault
          gaurav.garg

          There are no restrictions on the ptr? Do ypu see this problem only with numpy array or also with C allocated arrays?

            • Asynchronous stream write seg fault
              emuller

              Thanks for you reply.  On digging deeper, I uncovered a curiousity:

              (I'm working in Python, so forgive the pseudo code)

              s1 = Stream(dimensions)

              s2 = Stream(dimensions)

              s1.read(buf)

              s2.read(buf)

              s1.finish(); s2.finish()

              s1.write(buf1,async=True)

              s2.write(buf2,async=True)

              The second call to s2.write in async mode reveals the dimensions of s2 are rank=0.  If I call s1.finish() before the s2.write call, everything is fine. 

              The cause of my previous segfault was that I was not checking matching dimensions.  Perhaps I was reading the dimensions array which should have no elements if rank=0.

              But still, there is something problematic here.

              The same happens for:

              s1.write(buf1,async=True)

              s2.read(buf)

              again, the dimensions of s2. are revealed to be rank=0.  If I call s1.finish() before the s2.read call, everything is fine.

              This contradicts the documentation in 2.13.2 in the Stream User's guide, where an example is given of the same flavor as what I am doing above.  From what I observe, that example should not work.