View previous topic :: View next topic |
Author |
Message |
chaoslink
Joined: 23 Aug 2006 Posts: 37
|
Posted: Tue Aug 29, 2006 4:17 Post subject: |
|
|
Failed how? Did you add mutex protection? |
|
Back to top |
|
|
Zebranky
Joined: 04 Jun 2006 Posts: 415
|
Posted: Tue Aug 29, 2006 19:01 Post subject: |
|
|
I did. It still crashed at address 40b736. I think our crafting scripts may be too... resource-intensive... for it to handle, somehow. |
|
Back to top |
|
|
XShocK
Joined: 24 Sep 2006 Posts: 8
|
Posted: Tue Sep 26, 2006 0:50 Post subject: |
|
|
IF all that was is just a synchronization problem, then locking the criticalsection/mutex on the hook to the called function and unlocking on its end will do the job. If it still crashes... after several hours of work the first thing that comes to mind is that you did that criticalsection/mutex stuff wrong. Also check for memory leaks. One way to do that is using valgrind(if *nix), but that tends to be ridiculously slow and not many free alternatives in windoze. Another would be to hook the call to malloc/free(and their analogs). I cannot think of any other reason why program could segfault after several hours of work.
Again, memory leak will not be a source of the thing dieing on you, but if you can see it, then it may help you find the source of the problem. |
|
Back to top |
|
|
dumbo
Joined: 21 Aug 2005 Posts: 21
|
Posted: Tue Sep 26, 2006 7:49 Post subject: |
|
|
ppl, this task can't be done without breaking/freezing nwserver thread in safe place(such as events loop). if you even lock code part with mutex/cs, data will be unsynchronized. amen. |
|
Back to top |
|
|
XShocK
Joined: 24 Sep 2006 Posts: 8
|
Posted: Tue Sep 26, 2006 8:12 Post subject: |
|
|
I would agree with dumbo. To make sure there are no synchronization issues only pausing the thread can help. But why do you initially want to make such a thing anyway? You could simply synthesize the event yourself. Just make NPC speak, move it to the trap, do anything that would cause the event that fire the script. Not a very fancy way, but can be done in minutes without hacking around, plus quite efficient. |
|
Back to top |
|
|
Zebranky
Joined: 04 Jun 2006 Posts: 415
|
Posted: Mon Dec 25, 2006 21:11 Post subject: |
|
|
dumbo wrote: | ppl, this task can't be done without breaking/freezing nwserver thread in safe place(such as events loop). if you even lock code part with mutex/cs, data will be unsynchronized. amen. |
Yeah, this isn't a big surprise, but the trick is reverse-engineering the events loop.
XShocK wrote: | But why do you initially want to make such a thing anyway? You could simply synthesize the event yourself. Just make NPC speak, move it to the trap, do anything that would cause the event that fire the script. Not a very fancy way, but can be done in minutes without hacking around, plus quite efficient. |
I'm not sure what you mean by synthesizing the event myself. The point of this is to cause something to execute completely based on an external event. This would allow us to avoid polling anything, such as the DB (for Autobic's ELC) or Vaultster. Additionally, it would open the door for causing events efficiently from a web interface: reloading the module, booting players, getting an up-to-date player list, querying a player's current status, and so on. |
|
Back to top |
|
|
virusman
Joined: 30 Jan 2005 Posts: 1020 Location: Russia
|
Posted: Tue Mar 20, 2007 12:31 Post subject: |
|
|
Zebranky wrote: | Yeah, this isn't a big surprise, but the trick is reverse-engineering the events loop. | NWN Events is hell. I seriously doubt that anyone would really want to work with them (hooking, inserting, etc.).
Zebranky wrote: | I'm not sure what you mean by synthesizing the event myself. The point of this is to cause something to execute completely based on an external event. This would allow us to avoid polling anything, such as the DB (for Autobic's ELC) or Vaultster. Additionally, it would open the door for causing events efficiently from a web interface: reloading the module, booting players, getting an up-to-date player list, querying a player's current status, and so on. | You can do this by:
1. Polling the DB on heartbeat (slow solution, but I use it for my web interface: 6-second delay doesn't matter in most cases);
2. Hooking any nwserver function that gets called frequently enough (maybe even the main nwserver loop) and making your own events queue based on NWNX plugin. |
|
Back to top |
|
|
Zebranky
Joined: 04 Jun 2006 Posts: 415
|
Posted: Tue Mar 27, 2007 3:28 Post subject: |
|
|
Yeah, my new idea is to hook the main loop. I just have to get the time to sit down and write it... |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|