| 1 |
|
| 2 |
<HTML> |
| 3 |
<HEAD> |
| 4 |
<TITLE>The XPA Environment</TITLE> |
| 5 |
</HEAD> |
| 6 |
<BODY> |
| 7 |
|
| 8 |
|
| 9 |
<H2><A NAME="xpaenvl">XPAEnv: Environment Variables for XPA Messaging</A></H2> |
| 10 |
|
| 11 |
|
| 12 |
<H2>Summary</H2> |
| 13 |
Describes the environment variables which can be used to tailor the overall |
| 14 |
XPA environment. |
| 15 |
|
| 16 |
|
| 17 |
<H2>Description</H2> |
| 18 |
<P> |
| 19 |
The following environment variables are supported by XPA: |
| 20 |
<DL> |
| 21 |
<P> |
| 22 |
<DT><B>XPA_ACL</B> |
| 23 |
<DD> If <EM>XPA_ACL</EM> is <EM>true</EM>, then |
| 24 |
host-based <A HREF="./acl.html">XPA Access Control</A> |
| 25 |
is turned on and only specified machines can access specified access |
| 26 |
points. If <EM>false</EM>, then access control is turned off and any |
| 27 |
machine can access point. The default is turn turn access control on. |
| 28 |
|
| 29 |
<P> |
| 30 |
<DT><B>XPA_ACLFILE</B> |
| 31 |
<DD> If |
| 32 |
<A HREF="./acl.html">XPA Access Control</A> |
| 33 |
is turned on, this variable specifies the name of the file containing |
| 34 |
access control information for all access points started by this user. |
| 35 |
The default file name is: <EM>$HOME/acls.xpa</EM>. |
| 36 |
|
| 37 |
<P> |
| 38 |
<DT><B>XPA_CONNECT_TIMEOUT</B> |
| 39 |
<DD> When an XPA server first starts up, it immediately tries to |
| 40 |
connect to the XPA name server program (xpans) on the host specified by |
| 41 |
the <em>XPA_NSINET</em> variable. (If this connection fails on the |
| 42 |
local host, and if xpans can be found in the path, then the name |
| 43 |
server is started automatically.) Unfortunately, a mis-configured |
| 44 |
network can cause this connect attempt to hang for many seconds while |
| 45 |
the connect() system call times out. Therefore, an alarm is started |
| 46 |
to interrupt the connect() call and prevent a long hang. The initial |
| 47 |
value of the alarm timeout is 10 seconds, but can be changed by setting |
| 48 |
this environment variable. If you want to disable the alarm and allow |
| 49 |
the initial connect() to time out, set the value of this variable to |
| 50 |
0. Normally, users would not change this variable at all. |
| 51 |
|
| 52 |
<P> |
| 53 |
<DT><B>XPA_CLIENT_DOXPA</B> |
| 54 |
<DD> Normally, an XPA client (xpaget, xpaset, etc.) will process incoming |
| 55 |
XPA server requests while awaiting the completion of the client request. |
| 56 |
Setting this variable to "false" will prevent XPA server requests from |
| 57 |
being processed by the client. |
| 58 |
|
| 59 |
<P> |
| 60 |
<DT><B>XPA_DEFACL</B> |
| 61 |
<DD> If |
| 62 |
<A HREF="./acl.html">XPA Access Control</A> |
| 63 |
is turned on, this variable specifies the default access control |
| 64 |
condition for all access points, if the <EM>XPA_ACLFILE</EM> file does |
| 65 |
not exist. The default acl is: <EM>$host:* $host +</EM>, meaning that |
| 66 |
all processes on the host machine have full access to all access points. |
| 67 |
|
| 68 |
<P> |
| 69 |
<DT><B>XPA_HOST</B> |
| 70 |
<DD> |
| 71 |
For the INET socket method, XPA utilizes the canonical hostname (as |
| 72 |
returned by the gethostname() routine) to construct the IP part of the |
| 73 |
method id. Under some circumstances, this might not be a correct choice |
| 74 |
of name and IP. For example, if an XPA server is started on a machine |
| 75 |
running VPN, you might want to use the VPN name and IP instead of the |
| 76 |
canonical host name, so that other machines in the VPN network can |
| 77 |
access the server. In this case, you can set the XPA_HOST to be |
| 78 |
the VPN name (if resolvable) or, more easily, the VPN IP. |
| 79 |
|
| 80 |
<P> |
| 81 |
<DT><B>XPA_IOCALLSXPA</B> |
| 82 |
<DD> |
| 83 |
Setting this variable causes all XPA socket IO calls to process |
| 84 |
outstanding XPA requests whenever the primary socket is not ready for |
| 85 |
IO. This means that a server making a client call will (recursively) |
| 86 |
process incoming server requests while waiting for client completion. |
| 87 |
This inter-IO XPA processing avoids a rare |
| 88 |
<A HREF="./server.html#race">XPA Race Condition</A>: two or more |
| 89 |
XPA servers sending messages to one another using an XPA client |
| 90 |
routine such as XPASet() can deadlock while each waits for the other |
| 91 |
server to respond. This can happen, for example, if the servers call |
| 92 |
XPAPoll() with a time limit, and send messages in between the polling call. |
| 93 |
|
| 94 |
<P> |
| 95 |
By default, this option is turned off, because we judge that the added |
| 96 |
code complication and overhead involved will not be justified by the |
| 97 |
amount of its use. Moreover, processing XPA requests within socket IO |
| 98 |
can lead to non-intuitive results, since incoming server requests will |
| 99 |
not necessarily be processed to completion in the order in which they |
| 100 |
are received. |
| 101 |
|
| 102 |
<P> |
| 103 |
<DT><B>XPA_LOGNAME</B> |
| 104 |
<DD> |
| 105 |
XPA preferentially uses the de facto standard environment variable |
| 106 |
LOGNAME to determine the username when registering an access point in |
| 107 |
the name server. If this environment variable has been used for |
| 108 |
something other than the actual user name (such as a log file name), |
| 109 |
unexpected results can ensue. In such cases, use the XPA_LOGNAME |
| 110 |
variable to set the user name. (If neither exists, then getpwuid(geteuid()) |
| 111 |
is used as a last resort). |
| 112 |
|
| 113 |
<P> |
| 114 |
<DT><B>XPA_LONG_TIMEOUT</B> |
| 115 |
<DD> XPA is designed to allow data to be sent from one process to |
| 116 |
another over a long period of time (i.e., a program that generates |
| 117 |
image data sends that data to an image display, but slowly) but it |
| 118 |
also seeks to prevent hangs. This is done by supporting 2 timeout |
| 119 |
periods: a <EM>short</EM> timeout for protocol communication |
| 120 |
and a <EM>long</EM> for data communication. |
| 121 |
<P> |
| 122 |
The <EM>XPA_LONG_TIMEOUT</EM> variable controls the <EM>long</EM> |
| 123 |
timeout and is used to prevent hangs in cases where communication |
| 124 |
between the client and server that is <EM>not</EM> controlled by the |
| 125 |
XPA interface itself. Transfer of data between client and server, or a |
| 126 |
client's wait for a status message after completion of the server |
| 127 |
callback, are two examples of this sort of communication. By default, |
| 128 |
the <EM>long</EM> timeout is set to 180 seconds. |
| 129 |
Setting the value to -1 will disable <EM>long</EM> timeouts and allow |
| 130 |
an infinite amount of time. |
| 131 |
|
| 132 |
<P> |
| 133 |
<DT><B>XPA_MAXHOSTS</B> |
| 134 |
<DD> The maximum number of access points that the programs |
| 135 |
<EM>xpaset</EM>, <EM>xpaget</EM>, and <EM>xpainfo</EM> will |
| 136 |
communicate with at one time. The default is 64, meaning, for |
| 137 |
example, that the <EM>xpaset</EM> program will not send a message |
| 138 |
to more than 100 access points at one time and <EM>xpaget</EM> will |
| 139 |
not retrieve from more than 100 access points at one time. |
| 140 |
|
| 141 |
<P> |
| 142 |
<DT><B>XPA_METHOD</B> |
| 143 |
<DD> |
| 144 |
Determines the socket connection method used by this session of XPA. |
| 145 |
The choices are: <EM>inet</EM> (to use INET or Internet-based |
| 146 |
sockets), <EM>localhost</EM> (to use the machines localhost inet |
| 147 |
socket), or <EM>local (unix)</EM> (to use UNIX sockets). The default |
| 148 |
is <EM>INET</EM>. Using the <EM>inet</EM> method will allow access |
| 149 |
from other machines (subject to access controls) but using |
| 150 |
<EM>localhost</EM> or <EM>local</EM> will not. Localhost is most useful |
| 151 |
for private access and when the machine in question is not connected |
| 152 |
to the Internet. The unix method also can be used for private access |
| 153 |
and non-Internet connections (Unix platforms only). |
| 154 |
<P> |
| 155 |
Once defined, the first registration of an XPA access point will |
| 156 |
ensure that an instance of the |
| 157 |
<A HREF="./xpans.html">XPA Name Server (xpans)</A> |
| 158 |
is running that handles that connection method. All new access points |
| 159 |
will use the new connection method but existing access points will use |
| 160 |
the original method. |
| 161 |
|
| 162 |
<P> |
| 163 |
<DT><B>XPA_NSINET</B> |
| 164 |
<DD> For the <EM>inet</EM> method of socket connection, this variable |
| 165 |
specifies the host and port on which the |
| 166 |
<A HREF="./xpans.html">XPA Name Server (xpans)</A> |
| 167 |
is listens for new access points. The default is <EM>$host:$port</EM>, |
| 168 |
meaning that the default XPA port (14285) on the current machine |
| 169 |
(as returned by gethostname()) is used. If several machines were all |
| 170 |
accessing the same XPA access points, you would use this variable to |
| 171 |
specify that they all use the same name server to find out about these |
| 172 |
access points. For example, a value of <EM>myhost:$port</EM> would |
| 173 |
mean that the xpans name server is running on myhost and uses the |
| 174 |
default port 12345. All machines would then get the XPA access points |
| 175 |
registered with that name server, subject to access controls. |
| 176 |
<P> |
| 177 |
The port used by xpans to register its XPA access point normally is |
| 178 |
taken to be one greater than the port on which it receives new access |
| 179 |
points from XPA servers. You can specify a specific access point port |
| 180 |
using the syntax machine:port1,port2, i.e., the access point port is |
| 181 |
specified after the comma. For example, $host:12345,23456 will listen |
| 182 |
for new access ports on 12345 and will accept XPA commands on 23456. |
| 183 |
|
| 184 |
<P> |
| 185 |
<DT><B>XPA_NSREGISTER</B> |
| 186 |
<DD> |
| 187 |
This boolean variable specifies whether a server registers its XPA |
| 188 |
access point with the specified xpans name server. The default is |
| 189 |
<em>true</em>. If set to <em>false</em>, the access point still is |
| 190 |
set up but it is not registered with xpans and therefore cannot be |
| 191 |
accessed by name. (It can be accessed by method, if the latter is |
| 192 |
known.) Note that an access point can be registered later on (using |
| 193 |
-remote or -proxy, for example). This variable mainly is useful in |
| 194 |
cases where the Internet configuration is broken (so that registration |
| 195 |
causes a DNS hang) but you still wish to and can use the server with a |
| 196 |
remote xpans (e.g., ds9's Virtual Observatory capability). |
| 197 |
|
| 198 |
<P> |
| 199 |
<DT><B>XPA_NSUNIX</B> |
| 200 |
<DD> For the <EM>local</EM> method of socket connection, this variable |
| 201 |
specifies the name of the Unix file that will be used to access the |
| 202 |
<A HREF="./xpans.html">XPA Name Server (xpans)</A>. The default is |
| 203 |
<EM>xpans_unix</EM>. This variable is not usually needed. Note that |
| 204 |
is the <EM>local</EM> socket method is used, then remote machines will |
| 205 |
not be able to access the xpans name server or the registered XPA access |
| 206 |
points. |
| 207 |
|
| 208 |
<P> |
| 209 |
<DT><B>XPA_NSUSERS</B> |
| 210 |
<DD> |
| 211 |
This variable specifies whether other users' access points will be |
| 212 |
returned by the |
| 213 |
<A HREF="./xpans.html">XPA Name Server (xpans)</A> for use by |
| 214 |
<EM>xpaget</EM>, <EM>xpaset</EM>, etc. |
| 215 |
Generally speaking, it is sufficient to run one xpans name server per |
| 216 |
machine and register the access points for all users with that xpans. |
| 217 |
This means, for example, that if you request information from |
| 218 |
ds9 by running: |
| 219 |
<PRE> |
| 220 |
xpaget ds9 colormap |
| 221 |
</PRE> |
| 222 |
you might get information from your own ds9 as well as |
| 223 |
from another user running ds9 on the same machine. The |
| 224 |
<EM>XPA_NSUSERS</EM> variable controls whether you want such access |
| 225 |
to the access points of other users. |
| 226 |
By default, only your own access points are returned, so |
| 227 |
that, in the example above, you would only get the colormap information |
| 228 |
from the ds9 you registered. If, however, you had set the value of the |
| 229 |
<EM>XPA_NSUSERS</EM> variable to <EM>eric,fred</EM>, then you would be |
| 230 |
able to communicate with both eric and fred's access points. Note that |
| 231 |
this variable can be overridden using the <EM>-u</EM> switch on the |
| 232 |
<EM>xpaget</EM>, <EM>xpaset</EM>, and <EM>xpainfo</EM> programs. |
| 233 |
|
| 234 |
<P> |
| 235 |
<DT><B>XPA_PORT</B> |
| 236 |
<DD> |
| 237 |
A semi-colon delimited list of user specified ports to use for specific |
| 238 |
XPA access points. The format is each specification is: |
| 239 |
<PRE> |
| 240 |
class:template port1[ port2] |
| 241 |
</PRE> |
| 242 |
where <B>port1</B> is the main (command) port for the access point and |
| 243 |
<B>port2</B> is the (secondary) data port. If port2 is not specified, |
| 244 |
it defaults to a value of 0 (meaning the system assigns the port). |
| 245 |
|
| 246 |
<P> |
| 247 |
Specification of specific ports is useful, for example, when a machine |
| 248 |
outside a firewall needs to communicate with a machine inside a |
| 249 |
firewall. In such a case, the firewall should be configured to allow |
| 250 |
socket connections to both the command and data port from the outside |
| 251 |
machine, and the inside XPA program should be started up with the |
| 252 |
outside machine in its ACL list. Then, when the inside program is |
| 253 |
started with specified ports, outside XPA programs can use |
| 254 |
"machine:port" to contact the inside access points, instead of the |
| 255 |
access point names. That is, the machine outside the firewall does not |
| 256 |
need access to the XPA name server: |
| 257 |
<PRE> |
| 258 |
export XPA_PORT="DS9:ds9 12345 12346" # on machine "inside" |
| 259 |
cat foo.fits | xpaset inside:12345 fits # on machine "outside" |
| 260 |
</PRE> |
| 261 |
Note that 2 ports are required for full XPA communication and |
| 262 |
therefore 2 ports should be specified to go through a firewall. The |
| 263 |
second port assignment is not important if you simply are assigning |
| 264 |
the command port in order to communicate commands with a known |
| 265 |
port (e.g., to bypass the xpans name server). If only one (command) |
| 266 |
port is specified, the system will negotiate a random data port and |
| 267 |
everything will work properly. |
| 268 |
|
| 269 |
<P> |
| 270 |
This support is somewhat experimental. If you run into problems, please |
| 271 |
let us know. |
| 272 |
|
| 273 |
<P> |
| 274 |
<DT><B>XPA_PORTFILE</B> |
| 275 |
<DD> |
| 276 |
A list of user-specified port to use for specific xpa access points. |
| 277 |
The format of the file is: |
| 278 |
<PRE> |
| 279 |
class:template port1 [port2] |
| 280 |
</PRE> |
| 281 |
where <B>port1</B> is the main port for the access point and |
| 282 |
<B>port2</B> is the data port. If port2 is not specified, it defaults |
| 283 |
to a value of 0 (meaning the system assigns the port). See |
| 284 |
<B>XPA_PORT</B> above for an explanation of user-specified ports. |
| 285 |
|
| 286 |
<P> |
| 287 |
<DT><B>XPA_SHORT_TIMEOUT</B> |
| 288 |
<DD> XPA is designed to allow data to be sent from one process to |
| 289 |
another over a long period of time (i.e., a program that generates |
| 290 |
image data sends that data to an image display, but slowly) but it |
| 291 |
also seeks to prevent hangs. This is done by supporting 2 timeout |
| 292 |
periods: a <EM>short</EM> timeout for protocol communication |
| 293 |
and a <EM>long</EM> for data communication. |
| 294 |
<P> |
| 295 |
The <EM>XPA_SHORT_TIMEOUT</EM> variable |
| 296 |
controls the <EM>short</EM> timeout and is used to prevent hangs |
| 297 |
in cases where the XPA protocol requires internal communication between |
| 298 |
the client and server that is controlled by the XPA interface |
| 299 |
itself. Authentication is an example of this sort of communication, |
| 300 |
as is the establishment of a data channel between the two processes. |
| 301 |
The default value for the <EM>short</EM> is 30 seconds (which is |
| 302 |
a pretty long time, actually). Setting the value to -1 will disable |
| 303 |
<EM>short</EM> timeouts and allow an infinite amount of time. |
| 304 |
|
| 305 |
<P> |
| 306 |
<DT><B>XPA_SIGUSR1</B> |
| 307 |
<DD> If the value of this variable is <EM>true</EM>, then XPA will |
| 308 |
catch SIGUSR1 signals when performing an I/O operation in order to |
| 309 |
curtail that operation. This facility allows users to send a SIGUSR1 |
| 310 |
signal to an XPA server if a client is hanging up the server by |
| 311 |
sending or receiving data too slowly (timeouts also can be used -- see |
| 312 |
above). When enabled in this way, the SIGUSR1 signal is ignored at all other |
| 313 |
times, so that its safe to send the signal at any time. If the |
| 314 |
variable is set to <EM>false</EM>, then SIGUSR1 is not used at |
| 315 |
all. Turning off SIGUSR1 would be desired in cases there the program |
| 316 |
uses SIGUSR1 for some other reason and does not want XPA interfering. |
| 317 |
The default is to use the signal. |
| 318 |
|
| 319 |
<P> |
| 320 |
<DT><B>XPA_TIMESTAMP_ERRORS</B> |
| 321 |
<DD> If <EM>XPA_TIMESTAMP_ERRORS</EM> is <EM>true</EM>, then error |
| 322 |
messages will include a date/time string. This can be useful when |
| 323 |
XPA errors are being saved in an error log (e.g. Web/CGI use). The |
| 324 |
default is false. |
| 325 |
</DL> |
| 326 |
|
| 327 |
<P> |
| 328 |
<DT><B>XPA_TMPDIR</B> |
| 329 |
<DD> This variable specifies the directory into which XPA logs, Unix |
| 330 |
socket files (when <EM>XPA_METHOD</EM> is <EM>local</EM>), etc. are |
| 331 |
stored. The default is <EM>/tmp/.xpa</EM>. |
| 332 |
|
| 333 |
<P> |
| 334 |
<DT><B>XPA_VERBOSITY</B> |
| 335 |
<DD> Specify the verbosity level of error messages. If the value is |
| 336 |
set to <EM>0</EM>, <EM>false</EM>, or <EM>off</EM>, then no error |
| 337 |
messages are printed to stderr. If the value is <EM>1</EM>, then |
| 338 |
important XPA error messages will be output. If the value is |
| 339 |
set to <EM>2</EM>, XPA warnings about out-of-sync messages will also |
| 340 |
be output. These latter almost always can be ignored. |
| 341 |
|
| 342 |
<P> |
| 343 |
<DT><B>XPA_VERSIONCHECK</B> |
| 344 |
<DD> Specify whether a new access point should check its major and minor XPA |
| 345 |
version number against the version used by the xpans name server at |
| 346 |
registration time. The default is <EM>true</EM>. When checking is |
| 347 |
performed, a warning is issued if the server major version is found to |
| 348 |
be greater than the xpans version. Note that the check is performed |
| 349 |
both by the XPA server and by the xpans process and warnings will be |
| 350 |
issued by each. Also, instead of the values of <EM>true</EM> or |
| 351 |
<em>false</em>, you can give this variable an integer value n. In this |
| 352 |
case, each version checking process (i.e., the XPA-enabled server or |
| 353 |
xpans) will print out a maximum of n warning messages (after which |
| 354 |
version warnings are silently swallowed). |
| 355 |
<P> |
| 356 |
In general, it is a bad idea to run an XPA-enabled server program |
| 357 |
using a version of XPA newer than the basic xpaset, xpaget, xpaaccess, |
| 358 |
xpans programs. This sort of mismatch usually will not work due to |
| 359 |
protocol changes. |
| 360 |
|
| 361 |
|
| 362 |
|
| 363 |
|
| 364 |
|
| 365 |
<P> |
| 366 |
<A HREF="./help.html">Go to XPA Help Index</A> |
| 367 |
|
| 368 |
<H5>Last updated: December 23, 2009</H5> |
| 369 |
|
| 370 |
</BODY> |
| 371 |
</HTML> |