Hyperlink URL2 Crashing

Posted by Niobium on Sun 29 Nov 2009 11:24 PM — 3 posts, 15,480 views.

#0
(Edited for clarity and additional information.)

OS: Windows XP (up to date)
Client version: 4.44

I checked this thread http://www.gammon.com.au/forum/?id=9766 and I seem to be having the same problem. I used the instructions in there to create the Hyperlink_URL2 file, rather than get it from the site download, just to be safe. It sounds like I am having it happen a lot more often than this post author.

I've been working to narrow down what is causing it but since the effect causes the plugin to fail and gag any output with subsequent URLs, and it seems to happen on almost every URL, it's tough.

For example if I page myself a URL like http://www.youtube.com, there is no crash.

However, when the following URL is followed by a new line that has the first term being a Regular Expression trigger for someone's name, it always crashes the plugin, without exception:

http://the-b.org/Tinyfugue_smart_quotes

In this case, the URL itself is *not* gagged and is properly parsed, but all subsequent lines containing URLs are gagged and not parsed (as in, the entire line is omitted from output). The RegExp trigger name isn't gagged, but it is the last thing to be listed before the huge block of blank lines.

Another case: this URL is consistently crashing the plugin (the URL starts on a new line, but doesn't seem to matter if there's a trigger before or after it on another line or not):

http://my.barackobama.com/page/content/healthcarestories

Once one of these plugin crashes happens, it results in a huge block of blank lines filling the output to scroll it at least one page, sometimes more. This scroll usually starts from roughly the URL that causes the event, and occasionally it includes the URL but not always (see first case above). After the crash, all incoming lines that contain a URL vanish from output until the plugin is restarted. It will sometimes parse one or two URLs after a restart (nothing similar in ones it successfully parses, but it happens so seldom it's impossible to tell), but then it crashes again.

Crash output data is the same for *all* of these cases...

Error Number: 0

Event: Run-time error

Description:
[string "Plugin"]:60: C stack overflow
stack traceback:
[string "Plugin"]:60: in function <[string "Plugin"]:1>
[C]: in function 'Note'
[string "Plugin"]:69: in function <[string "Plugin"]:1>
[C]: in function 'Note'
[string "Plugin"]:69: in function <[string "Plugin"]:1>
[C]: in function 'Note'
[string "Plugin"]:69: in function <[string "Plugin"]:1>
[C]: in function 'Note'
[string "Plugin"]:69: in function <[string "Plugin"]:1>
[C]: in function 'Note'
[string "Plugin"]:69: in function <[string "Plugin"]:1>
...
[C]: in function 'Note'
[string "Plugin"]:69: in function <[string "Plugin"]:1>
[C]: in function 'Note'
[string "Plugin"]:69: in function <[string "Plugin"]:1>
[C]: in function 'Note'
[string "Plugin"]:69: in function <[string "Plugin"]:1>
[C]: in function 'Note'
[string "Plugin"]:69: in function <[string "Plugin"]:1>
[C]: in function 'ColourTell'
[string "Plugin"]:66: in function <[string "Plugin"]:1>

Called by: Function/Sub: OnHyperlink called by trigger
Reason: processing trigger ""

(Apologies, I don't know the forum code to block that out like I see people doing sometimes.)

This looks identical to the output from the other thread.

I'm not sure if it matters but I do have a very large number of complex triggers relating to hi-lighting terms and names, italicizing, etc. They're all RegExp and all but one or two are fall-through (KeepEvaluating). Is there anything else I should provide?

I really want to be able to click on links in MUSHClient but I've never been able to get Hyperlink_URL2 to not crash. Any ideas on what I need to do?

-- Niobium
Amended on Mon 30 Nov 2009 12:18 AM by Niobium
#1
Yet more testing. I took an empty world, connected to a MUCK, and confirmed that with *no* other triggers enabled, the plugin doesn't crash. I am slowly re-adding triggers to see if one in particular causes it, but nothing so far.

Edit: I think I have it narrowed down to something to do with Custom Colors. I use Custom Colors for a lot of the afore-mentioned triggers, and when adding them back in nothing went wrong, I decided maybe my old world file was just corrupt. So I began getting the custom colors and triggers all set back up, and when I changed one of the custom colors, as soon as the screen reloaded I got the crash on one of the offending URLs. I haven't been able to reproduce it reliably this way. Another possibility is it has to do with newlines, since even with all of my triggers removed from the world it would still happen.

And now for a different problem. The plugin is putting a newline at the end of some URLs (not all, just 'long' ones, where 'long' means 'longer than one line so it needs to wrap'). Any way to disable that? I don't want it to do this. I want whatever text was supposed to flow after it to do so normally.

--Niobium
Amended on Mon 30 Nov 2009 01:24 AM by Niobium
Australia Forum Administrator #2
My initial guess is it is something to do with this:


  while i <= table.getn(styles) do -- Doesn't use pairs() because of problems with field-injection.
    if doingURL == 0 then
 
-- blah blah

      else

-- blah blah

        table.insert(styles, i + 1, {textcolour = styles[i].textcolour
                                ,backcolour = styles[i].backcolour
                                ,style = styles[i].style
                                ,text = string.sub(styles[i].text, cut)})
        doingURL = 1
        hyperlinkcount = hyperlinkcount + 1
      end -- if


This has the potential to go into a loop, as it is going until the end of the styles table, but in the middle is making it longer, under certain conditions.