• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

CMD error

Newbie Spellweaver
Joined
Jul 17, 2008
Messages
51
Reaction score
4
Currently experiencing this, any advice?


9k5R5Ct - CMD error - RaGEZONE Forums
 
Junior Spellweaver
Joined
Sep 11, 2014
Messages
181
Reaction score
76
server.maps.MapleMap:
Code:
private int runningOid = 100;

increase the number to like 100,000 or something

That's just the starting oid, pretty sure that will do nothing. In fact if you set that too high you might get that exception every time. There's a max oid when an object is set though. I didn't know it was even possible to run out though, since it reuses object ids right? Either way there shouldn't be a cap for OID since it just doens't make sense. It doesn't save memory at all. Still It's very surprising how you even managed to have the max oids at once since when you reach the max oid, it will start over and go back to the runningOid. Then it will loop and try to find a nontaken oid.
 
Upvote 0
Newbie Spellweaver
Joined
Jul 17, 2008
Messages
51
Reaction score
4
" private void incrementRunningOid() {
runningOid++;
if (runningOid >= 3000000) {
runningOid = 100000;//Lol, like there are monsters with the same oid NO " ? is that enough?


server.maps.MapleMap:
Code:
private int runningOid = 100;

increase the number to like 100,000 or something
 
Upvote 0
Custom Title Activated
Loyal Member
Joined
Jan 18, 2010
Messages
3,109
Reaction score
1,139
That's just the starting oid, pretty sure that will do nothing. In fact if you set that too high you might get that exception every time. There's a max oid when an object is set though. I didn't know it was even possible to run out though, since it reuses object ids right? Either way there shouldn't be a cap for OID since it just doens't make sense. It doesn't save memory at all. Still It's very surprising how you even managed to have the max oids at once since when you reach the max oid, it will start over and go back to the runningOid. Then it will loop and try to find a nontaken oid.

Oh, right, didn't see that.. In my Lithium source the runningOid was 500k, and there's no thrown exception for Out of OIDs.. Didn't see that Moople throws that exception when it's greater than 30k. You're right, that's actually really odd. It should be done like in Lithium, when you add a Map Object, it gets an int (newOid) which is an incremented runningOid, and then applies that newOid as the object.

PHP:
public final void addMapObject(final MapleMapObject mapobject) {
        runningOidLock.lock();
        int newOid;
        try {
            newOid = ++runningOid;
        } finally {
            runningOidLock.unlock();
        }

        mapobject.setObjectId(newOid);

        mapobjectlocks.get(mapobject.getType()).writeLock().lock();
        try {
            mapobjects.get(mapobject.getType()).put(newOid, mapobject);
        } finally {
            mapobjectlocks.get(mapobject.getType()).writeLock().unlock();
        }
    }

So, isn't that better than doing this? :
PHP:
public void addMapObject(MapleMapObject mapobject) {
        objectWLock.lock();
        try {
            mapobject.setObjectId(runningOid);
            this.mapobjects.put(Integer.valueOf(runningOid), mapobject);
            incrementRunningOid();
        } finally {
            objectWLock.unlock();
        }
    }

private void incrementRunningOid() {
        runningOid++;
        if (runningOid >= 30000) {
            runningOid = 1000;//Lol, like there are monsters with the same oid NO
        }
        objectRLock.lock();
        try {
            if (!this.mapobjects.containsKey(Integer.valueOf(runningOid))) {
                return;
            }
        } finally {
            objectRLock.unlock();
        }
        throw new RuntimeException("Out of OIDs on map " + mapid + " (channel: " + channel + ")");
    }

" private void incrementRunningOid() {
runningOid++;
if (runningOid >= 3000) {
runningOid = 100000;//Lol, like there are monsters with the same oid NO " ? is that enough?

Yes, that looks like correct to me.
 
Upvote 0
Junior Spellweaver
Joined
Sep 11, 2014
Messages
181
Reaction score
76
Running Oid needs a lock? Even if it wasn't threadsafe I don't see the problem of making it race conditions. You're just incrementing by 1, so there shouldn't be a problem with it.
 
Upvote 0
Back
Top