Hi,
We came about a situation, where we keep (some of) our audio files on NFS,
which can die. (other filesystems can do that also, so I think this topic is
important to people not using NFS as well)
Here's how I broke down the possible scenarios:
a1,
all your files on the same fs, all your calls use at least one of the files:
thats too bad, nothing SEMS can do for you
a2,
all your files on the same fs, you have calls that don't use files: you're OK,
the signaling is done in separate threads if you don't use threadpools, so
don't, the file-less calls will work in this case.
UNLESS
a2-python,
you're using IVR and python, in which case you'll be suprised to see you're
not receiving any new calls if you have a session blocking in opening the
file: that's because python (and IVR) holds the GIL during file operations. I
have attached a patch that addresses this problem, I hope I covered every
case.
b,
some of your files on NFS, some are not:
if you're extremely lucky (under reasonable load, you're not), none of the
sessions running when the NFS goes down, so the involved sessions will get
stuck in open(), in this case the non-NFS using sessions will work
undisturbed. But if you have a session getting stuck in read(), the
AmMediaProcessor thread(s) will get stuck, and even the non-NFS sessions will
lose audio. This could be solved if we have more then one AmMediaProcessor
thread, different callgroup to NFS and non-NFS sessions and mechanism to
assign callgroups to a specific AmMediaProcessor thread. The last part is
missing, addSession() adds the callgroup to the thread with the lowest load.
Do you think there would be interest if I implemented this mechanism? Any
suggestions?
TIA
br
Szo
Only in ib2/callcontrol/apps/ivr//etc: .svn
diff -ruw sems-1.4.0/apps/ivr//IvrAudio.cpp gil/apps/ivr//IvrAudio.cpp
--- sems-1.4.0/apps/ivr//IvrAudio.cpp 2011-03-15 11:48:23.000000000 +0100
+++ gil/apps/ivr//IvrAudio.cpp 2011-07-15 11:49:22.000000000 +0200
@@ -92,7 +92,11 @@
return NULL;
}
- if(self->af->open(filename,open_mode,is_tmp)){
+ int i;
+Py_BEGIN_ALLOW_THREADS
+ i = self->af->open(filename,open_mode,is_tmp);
+Py_END_ALLOW_THREADS
+ if(i){
PyErr_SetString(PyExc_IOError,"Could not open file");
return NULL;
}
@@ -130,7 +134,11 @@
return NULL;
}
- if(self->af->fpopen(filename,open_mode,fp)){
+ int i;
+Py_BEGIN_ALLOW_THREADS
+ i = self->af->fpopen(filename,open_mode,fp);
+Py_END_ALLOW_THREADS
+ if(i){
PyErr_SetString(PyExc_IOError,"Could not open file");
return NULL;
}
@@ -150,10 +158,12 @@
if(!PyArg_ParseTuple(args,"|i",&rew_time))
return NULL;
+Py_BEGIN_ALLOW_THREADS
if (rew_time != 0)
self->af->rewind(rew_time);
else
self->af->rewind();
+Py_END_ALLOW_THREADS
Py_INCREF(Py_None);
return Py_None;
@@ -194,7 +204,9 @@
static PyObject* IvrAudioFile_close(IvrAudioFile* self, PyObject*)
{
+Py_BEGIN_ALLOW_THREADS
self->af->close();
+Py_END_ALLOW_THREADS
Py_INCREF(Py_None);
return Py_None;
}
@@ -218,11 +230,12 @@
static PyObject* IvrAudioFile_exportRaw(IvrAudioFile* self, PyObject*)
{
+Py_BEGIN_ALLOW_THREADS
if(self->af->getMode() == AmAudioFile::Write)
self->af->on_close();
self->af->rewind();
-
+Py_END_ALLOW_THREADS
return PyFile_FromFile(self->af->getfp(),"","rwb",NULL);
}
_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev