Two Instances on Linux IDS2000
Posted in 2000
Starting a second IDS 2000 instance on Linux failed with "shmget: shared memory already exists" (key 52574801) / "mt_shm_init: can't create resident segment", despite distinct SERVERNUM, DBSERVERNAME, sqlhosts entries and ports. Art Kagel explained the key is derived from a base (0x52564800) plus SERVERNUM, so causes are duplicate SERVERNUM, a wrong ONCONFIG environment variable, or leftover shared memory from a failed/running instance. Here it was the last: a stale 'oninit -s' process; killing it freed the segment and the instance started with SERVERNUM=1. Cleanup tips: onmode -ky, or ipcrm -m/-M.
Auto-generated by DrWatson from the posts below — may be imperfect; read the full thread.
Topics: Platform-Specific Issues
Hi guys, I'm trying to set up a second instance on a Linux version of IDS2000 using a different TCP Port for SOCTCP connection and, obviously, different server number & name. I get a fatal error in shared memory creation: shmget:[EEXIST[17]]: key[52574801]: shared memory already exists mt_shm_init: can't create resident segment Is this a limitation of a Linux version or am I wrong somewhere? TIA -- Andrea Verni System Administrator Telit Mobile Terminals S.p.A. Viale Stazione di Prosecco, 5/B - 34010 Sgonico(TS) Tel. +39-040-3756915 Fax. +39-040-3756901
Andrea Verni wrote: > Hi guys, > > I'm trying to set up a second instance on a Linux version of IDS2000 > using a different TCP Port for SOCTCP connection and, obviously, > different server number & name. > > I get a fatal error in shared memory creation: > > shmget:[EEXIST[17]]: key[52574801]: shared memory already exists > mt_shm_init: can't create resident segment > > Is this a limitation of a Linux version or am I wrong somewhere? Yes, you are. 1. As I understand you have two different onconfigs with a. different SERVERNUM b. different DBSERVERNAME 2. sqlhosts with different strings for both servers 3. Have you seen $INFORMIXSERVER/release/en_us/0333/IDS_9.2 for possible TCP/IP protocols? 4. Have you set correct servicenames in sqlhosts & /etc/services? > > > TIA > > -- > Andrea Verni > System Administrator > Telit Mobile Terminals S.p.A. > Viale Stazione di Prosecco, 5/B - 34010 Sgonico(TS) > Tel. +39-040-3756915 > Fax. +39-040-3756901
Marat wrote: > 1. As I understand you have two different onconfigs with > a. different SERVERNUM > b. different DBSERVERNAME yes > 2. sqlhosts with different strings for both servers yes > 3. Have you seen $INFORMIXSERVER/release/en_us/0333/IDS_9.2 > for possible TCP/IP protocols? onsoctcp is the correct TCP/IP implementation valid for both instances. (I already have 1 instance running with this protocol) > 4. Have you set correct servicenames in sqlhosts & /etc/services? yes, /etc/services is correct for both instances. Maybe something with kernel parameters? AV
Andrea Verni wrote: > > Hi guys, > > I'm trying to set up a second instance on a Linux version of IDS2000 > using a different TCP Port for SOCTCP connection and, obviously, > different server number & name. > > I get a fatal error in shared memory creation: > > shmget:[EEXIST[17]]: key[52574801]: shared memory already exists > mt_shm_init: can't create resident segment The shared memory key is made by adding (0x10000 * SERVERNUM) to a base key of 0x52564800, the low order digit indicating which segment of the two or more shared memory segments Informix creates. So the server you are starting up thinks it is SERVERNUM 1 and there is already shared memory allocated to the corresponding key for the RESIDENT segment (0x52574801). Three possibilities: 1) you have the same SERVERNUM in both ONCONFIG files 2) you forgot to set the ONCONFIG environment variable to the OTHER ONCONFIG file and it is still looking at the one for the first server 3) you tried to bring the engine up previously and it is either already up or it crashed leaving shared memory allocated. If the SERVERNUM for the second server is NOT '1' then the problem must be #2. Art S. Kagel > Is this a limitation of a Linux version or am I wrong somewhere? > > TIA > > -- > Andrea Verni > System Administrator > Telit Mobile Terminals S.p.A. > Viale Stazione di Prosecco, 5/B - 34010 Sgonico(TS) > Tel. +39-040-3756915 > Fax. +39-040-3756901
"Art S. Kagel" wrote: > The shared memory key is made by adding (0x10000 * SERVERNUM) to a base > key of 0x52564800, the low order digit indicating which segment of the two or > more shared memory segments Informix creates. So the server you are > starting up thinks it is SERVERNUM 1 and there is already shared memory > allocated to the corresponding key for the RESIDENT segment (0x52574801). Server number are different in both instances. I currently use SERVERNUM=0 for the first instance and SERVERUM=1 for the second. Infact, I can see that segment 0x52574801 is already assigned. I tried to set SERVERNUM=2 in the second instance and the database started. Is this an Informix bug or should I never set 0 to SERVERNUM ? TIA AV
Thanks all,
it was only an 'oninit -s' zombie process. I killed him, resources has
been released and the 2nd instance started perfectly with SERVERNUM=1.
Thanks.
AV
Andrea Verni wrote:
>
> "Art S. Kagel" wrote:
>
> > The shared memory key is made by adding (0x10000 * SERVERNUM) to a base
> > key of 0x52564800, the low order digit indicating which segment of the two or
> > more shared memory segments Informix creates. So the server you are
> > starting up thinks it is SERVERNUM 1 and there is already shared memory
> > allocated to the corresponding key for the RESIDENT segment (0x52574801).
>
> Server number are different in both instances. I currently use
> SERVERNUM=0 for the first instance and SERVERUM=1 for the second.
>
> Infact, I can see that segment 0x52574801 is already assigned. I tried
> to set SERVERNUM=2 in the second instance and the database started.
>
> Is this an Informix bug or should I never set 0 to SERVERNUM ?
Zero is a valid SERVERNUM, though I try to avoid it just for asthetic
reasons. Looks like you had tried to bring the server #1 up once before
and it did not completely come up but left the shared memory around. If
you see this again first try running onmode -ky, even though the server is
not up, and it will try to remove the shared memory segment. If that does
not work you can remove it manually with ipcrm -m <id> or ipcrm -M <key>
for any segments owned by Informix which have the expected key. I calculate
the first four hex digits of the shared memory key for each of my servers
and place it in a comment at the bottom of that server's ONCONFIG file so
that I can just tail $INFORMIXDIR/etc/$ONCONFIG to get the key. Just take
the base key's high order 4 HEX digits (0x5256) and add the SERVERNUM
converted to HEX. So your server #0 uses memory keys starting with 0x5256
and the second server, now server #2, uses memory keys starting with 0x5258.
Art S. Kagel