erickson [Tue, 12 Oct 2010 02:59:37 +0000 (02:59 +0000)]
when we add xhr responses onto the end of the queue, stash the original session as well, otherwise we're attempting to ask a session questions about requests it's not tracking
Install DateTime packages rather than relying on CPAN
etch and hardy have all but DateTime::Format::ISO8601 packaged;
if we don't install the DateTime packages, D:F:ISO8601 forces a CPAN
install - and building current versions of DateTime appears to be problematic
on Hardy, at least
We were installing these packages as prereqs in the Evergreen Makefile.install,
so this problem might stem all the way back to the split of the Evergreen and
OpenSRF dependency installers.
dbs [Fri, 29 Jan 2010 02:51:11 +0000 (02:51 +0000)]
Apply one more portability patch from Dan McMahill
patch-ae -- $$(command) is ok with bash and ksh but is not portable to
all /bin/sh implementations. Also instead of hard coding
"apxs2" use the APXS2 variable which was set during the
configure process. This is especially helpful when the
binary is installed as apxs instead of apxs2.
Finally, remove the DEF_LDLIBS from the apxs2 compilation/link
line. As near as I can tell this only removed -lopensrf which
is ok because we already had libopensrf.so explicitly listed.
Including -lopensrf didn't work correctly since libopensrf
had been built but not yet installed.
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
Signed-off-by: Dan McMahill <dmcmahill@NetBSD.org>
git-svn-id: svn://svn.open-ils.org/OpenSRF/branches/rel_1_2@1908 9efc2488-bf62-4759-914b-345cdb29e865
dbs [Fri, 29 Jan 2010 02:48:00 +0000 (02:48 +0000)]
Apply patches for enhancing portability, from Dan McMahill
The following is a list of the patches and a brief description of what
they are supposed to address. They were needed for building OpenSRF-1.2.0
(the most recent release) on a NetBSD system.
patch-aa -- some systems have dlerror() in libc instead of libdl so use
AC_SEARCH_LIBS to see if we need an explicit -ldl or not.
Fail in the same way as the previous code if we can't find
dlerror() anywhere.
malloc_stats() is malloc implementation specific so check for
it and define HAVE_MALLOC_STATS if we do.
patch-ab -- No need to explicitly list -lxml2 -ldl -lmemcache in LDADD.
These were automatically filled in via the LIBS variable which
is filled in via AC_SEARCH_LIBS and AC_CHECK_LIB. Also this
way -ldl only shows up if it is actually needed.
patch-ac -- Only conditionally call malloc_stats() if it exists. On
systems without malloc_stats(), just print a warning to the
effect.
patch-ad -- Instead of using -lopensrf for foo_la_LIBADD use
@top_builddir@/src/libopensrf/libopensrf.la. This
is the way to link to the not-yet-installed libtool
library we just built.
patch-af -- "sed -i" is a GNU sed extension and not portable to Solaris or the
various BSDs. Rework the target a little to be more portable.
patch-ag -- Use /bin/sh instead of /bin/bash. And to make sure this will work
on non-Linux systems where /bin/sh is *not* bash, make things a little
more portable. The biggest is that
function foo { code here }
is replaced by the more portable
foo() {code here}
syntax.
patch-ah -- Use /bin/sh instead of /bin/bash. And to make sure this will work
on non-Linux systems where /bin/sh is *not* bash, make things a little
more portable. Of note, "echo -e" is non-portable so instead use
as "here document" which is more portable and also I think easier to
edit anyway. Also address the function syntax and finally "==" is
a bash extension to "test". "=" does the same thing and is portable
to other shells.
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
Signed-off-by: Dan McMahill <dmcmahill@NetBSD.org>
git-svn-id: svn://svn.open-ils.org/OpenSRF/branches/rel_1_2@1907 9efc2488-bf62-4759-914b-345cdb29e865
erickson [Mon, 25 Jan 2010 16:29:58 +0000 (16:29 +0000)]
Added some fault tolerance to the inbound-to-unixserver message handoff process. In some conditions, the unix socket will result in sigpipe (anecdotally, seen more oftenvirtualized environments). these changes add a call to select before writing to the socket to check for socket availability and add a sigpipe handler that forces the inbound process to wait a brief period of time before trying the delivery again
erickson [Wed, 2 Dec 2009 22:43:51 +0000 (22:43 +0000)]
Prevent infinite loop (with logging) in child process reaping.
From the perl docs on waitpid:
Note that on some systems, a return value of "-1" could mean that child processes are being automatically reaped. See perlipc for details, and for other examples.
This is a performance tweak to the osrfHashGet function, a widely
used utility function.
The old version accepted a variable number of arguments: a pointer
to an osrfHash, a string optionally containing printf-style
format specifiers, and addtional parameters as needed to fill in
the blanks.
In practice, none of the code ever uses the printf-style formatting.
We always pass exactly two parameters. We burn CPU cycles scanning
the string for format specifiers and never find any.
I eliminated the unused variable parameters and turned osrfHashGet()
into a simple two-parameter function. Just in case anybody ever
wants it, I also cloned the original version into a new function
named osrfHashGetFmt, which accepts a variable number of arguments
as before.
Note that, since the signature of the function is changing,
it is necessary to recompile any open-ils programs that
call it, namely:
Add two new commands, "open" and "close", to open and close ongoing
connections to specified services. (Otherwise a connection is created
and destroyed for every request.)
Main purpose: to be able to use srfsh for database operations that require
transactions.
Warning: typically the <keepalive> value will need to be increased for
the service in question in opensrf.xml, or else the server will close
the connection before you can type your request.
erickson [Thu, 11 Jun 2009 13:10:36 +0000 (13:10 +0000)]
until we make the router / C processes write their own PID file, put a short sleep in after startup to give each time to show up in the 'ps' output. this should help prevent lingering router processes after service stop
erickson [Wed, 10 Jun 2009 21:46:00 +0000 (21:46 +0000)]
added a session_data disctionary to ServerSession class for storing per-session data. fixed bug where no params caused serer-side confusion. added exmample of session_data usage to example app
erickson [Wed, 3 Jun 2009 15:58:20 +0000 (15:58 +0000)]
flush_socket now flushes data through the xml stream parser to prevent the destorying the validity of the stream. now discarding RESULT messages passed to server sessions.
dbs [Sun, 31 May 2009 19:49:00 +0000 (19:49 +0000)]
Use autotools a bit more to our advantage:
* In osrf_ctl.sh, use the configured location for osrf_config by default
* Differentiate between prefix and exec_prefix to respect configure options
* Make configure output slightly more consistent
scottmk [Tue, 31 Mar 2009 18:30:10 +0000 (18:30 +0000)]
1. Create a new osrfListExtract function, which removes an item
from an osrfList without destroying it, and returns a pointer to
the item thus removed.
2. Create a new jsonObjectExtractIndex, which removes a
specified entry in a JSON_ARRAY, and returns a pointer
to it, without destroying it.
3. In osrf_json.h: Corrected an inaccurate comment about
jsonObjectRemoveIndex(). Contrary to the original comment, this
function does not shift other objects down to fill the gap.
scottmk [Tue, 31 Mar 2009 12:45:53 +0000 (12:45 +0000)]
In osrf_system_shutdown(): provide a return value for an early
return (since the function is of type int).
It's not clear whether these are the right semantics, since we
never capture the return value anyway. But if we're going
to return anything at all, it makes sense to return something
different in the case of an early return.
erickson [Tue, 17 Feb 2009 17:47:18 +0000 (17:47 +0000)]
not sure why this is an issue now (different perl/json:xs verions?), but
$obj->{$k} = JSONObject2Perl($bool)
results in 'Modification of a read-only value attempted', while
$obj->{$k} = $bool
does not, even though the JSON::XS::Boolean object is not altered by JSONObject2Perl().
just missing something?
patched
scottmk [Thu, 29 Jan 2009 03:58:26 +0000 (03:58 +0000)]
This update mainly tightens the error handling.
1. If there aren't enough arguments on the command line, return EXIT_FAILURE
instead of zero.
2. Defer the call to set_proc_title() until we are done using the command
line arguments, so that we don't have to make copies of them.
3. Check the return value from osrfConfigInit(). Otherwise a NULL (caused,
e.g., by a missing config file) leads to a segfault.
4. If the config file doesn't define any routers to spawn, exit immediately
with an error message before entering the fork loop.
5. If a child process returns (due to an error) instead of entering the
normal endless loop, break out of the fork loop. Otherwise the child
remains in the fork loop and spawns children of its own (unless it's the
last child to be spawned). At best, that's just silly.
6. Append an newline to a message issued from setupRouter(). (It's not
clear why this message goes directly to stderr instead of to the usual
logging machinery, which at this point is directed to stderr anyway.)
scottmk [Thu, 15 Jan 2009 02:05:24 +0000 (02:05 +0000)]
Add a new function osrfStringArrayTokenize. It parses an input
string into tokens separated by a specified delimiter character,
much like strtok() or strtok_r(), and loads them into an
osrfStringArray.
scottmk [Wed, 14 Jan 2009 14:36:14 +0000 (14:36 +0000)]
Add a function osrfMethodVerifyContext() to do what the
existing OSRF_METHOD_VERIFY_CONTEXT macro does. Use it in
_osrfAppRunSystemMethod() and osrfAppEcho().
erickson [Tue, 13 Jan 2009 20:33:01 +0000 (20:33 +0000)]
need a copy of the service when it's pulled from the cache, since the sessionCache object is freed. use apr_pstrdup so Apache will manage the memory for us
scottmk [Mon, 12 Jan 2009 05:35:10 +0000 (05:35 +0000)]
1. Replaced the innards of an osrfStringArray to include an
osrfList instead of a pointer to an osrfList. This change
eliminates a layer of malloc and free when creating and
destroying an osrfStringArray. It also eliminates a layer
of indirection when performing other operations.
2. Eliminated the prototype for string_array_get_total_size(),
since no such function exists.
3. Added the const qualifier to various function parameters.
scottmk [Sun, 11 Jan 2009 22:11:34 +0000 (22:11 +0000)]
In the macro OSRF_LIST_GET_INDEX: placed all occurrences of the macro arguments
in parentheses, to prevent unexpected effects when one or more of the
arguments is an expression.
scottmk [Fri, 9 Jan 2009 20:14:35 +0000 (20:14 +0000)]
Move the xmlSAXHandler out of the header and into the
implementation file, along with the prototypes of the
associated callback functions (which are now static)
scottmk [Fri, 9 Jan 2009 18:51:01 +0000 (18:51 +0000)]
Move the xmlSAXHandler out of the header and into the
implementation file, along with the declarations of the
associated callback functions (which are now static)