I did very simple test, replaced write with aio_write and at the end
checked aio_error/aio_return, they all returned 0 so mmap should work
because file is synced. when i was doing aio_write i used aio_offset, so
each aio_write would put data into separate region on the file.
Unfortunately i removed modified driver.c by accident, so i will have to
do it again but something is not right in simply replacing write with
aio_write and mmap. Without mmap, GetForm will have to read the file
manually and parse it, it makes it more complicated and still, if writes
are not complete we may get SIGBUS again.
The problem i see here i cannot be sure that all writes are completed,
aio_error/aio_return are used to check only one last operation, not the
batch of writes.
Zoran Vasiljevic wrote:
Am 02.01.2006 um 12:06 schrieb Zoran Vasiljevic:
Am 02.01.2006 um 04:43 schrieb Vlad Seryakov:
Tried it, nsd started crashing and i am guessing that the problem is
combination of aio_write and mmap.
When is start spooling, i just submit aio_write and return
immediately, so there are a lot of quick aio_write calls. By the
time i reach mmap, it looks like it's always ahead of actual
writing, so even when i am trying to check aio_error/aio_fsync in
the NsGetRequest, i still get SIGBUS/SIGSEGV when i access reqPtr-
>content, looks like mmap and aio_write are out of sync. And there
is no way to wait until all file buffers will be flushed, so manual
separate thread implementation could be the only portable solution.
Or i just do not understand aio_xxx things completely.
Hm... the idea is to mmap the file when all is read from the client.
So you'd have to aio_write into the file until all is received, then
at some point check the aio_status of the write (non-blocking) and
when it's done, revert to mmap the file. I do not believe you can
mix the aio_ with mmap.
What I still do not know is: if you are allowed to issue multiple
outstanding aio_writes one after another... It might be that you
need to check wether the first aio_write is done before you attempt
the next one.
Zoran
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log
files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
naviserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/naviserver-devel
--
Vlad Seryakov
571 262-8608 office
[EMAIL PROTECTED]
http://www.crystalballinc.com/vlad/