catching errors in local JavaScript

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

catching errors in local JavaScript

Amir E. Aharoni
Hallo Wikitech community,

Remind me please, were there ever any efforts to get client-side JavaScript
errors monitored centrally?

What happens currently is that JS code can frequently fail, taking down the
rest of JS on the page with it. It happens both with JS code properly
deployed from Gerrit and loaded by RL, but even more so with local gadgets,
Common.js, and user scripts.

The most frequent effects of this into which I ran are Visual Editor not
working at all and WikiEditor's toolbar not appearing in the source editing
window. There are many more.

On projects with a lot of editors and administrators, like the English and
the German Wikipedia, this will probably be quickly noticed and
fixed—sometimes fixed locally, and sometimes fixed in Gerrit and deployed
in SWAT. But in smaller projects it can fail for months without being
noticed. And when I say "smaller", I don't mean the tiny projects with
almost no editors—such a thing happened recently in the Japanese Wikipedia,
a top-10 project, and I helped administrators there to fix the buggy code,
which appeared in the second most-popular gadget.

I did this dozens of times, and Krinkle probably does this even more than
me. Often admins from different projects help each other, and it is great
that we have this mutual help in the community, but aren't there better
ways to catch such errors?

I remember there were discussions about this, but I don't remember what was
the outcome.

--
Amir Elisha Aharoni · אָמִיר אֱלִישָׁע אַהֲרוֹנִי
http://aharoni.wordpress.com
‪“We're living in pieces,
I want to live in peace.” – T. Moore‬
_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: catching errors in local JavaScript

James Hare-4
I would find such a tool to be extremely useful as well. I am working on an
extension that uses a considerable amount of JavaScript and while we’re
trying to find as many breakdowns as we can, it’s entirely possible we’ll
miss something and the person who discovers the bug won’t be familiar with
debugging tools like the in-browser JavaScript console.


On January 18, 2017 at 8:26:32 AM, Amir E. Aharoni (
[hidden email]) wrote:

Hallo Wikitech community,

Remind me please, were there ever any efforts to get client-side JavaScript
errors monitored centrally?

What happens currently is that JS code can frequently fail, taking down the
rest of JS on the page with it. It happens both with JS code properly
deployed from Gerrit and loaded by RL, but even more so with local gadgets,
Common.js, and user scripts.

The most frequent effects of this into which I ran are Visual Editor not
working at all and WikiEditor's toolbar not appearing in the source editing
window. There are many more.

On projects with a lot of editors and administrators, like the English and
the German Wikipedia, this will probably be quickly noticed and
fixed—sometimes fixed locally, and sometimes fixed in Gerrit and deployed
in SWAT. But in smaller projects it can fail for months without being
noticed. And when I say "smaller", I don't mean the tiny projects with
almost no editors—such a thing happened recently in the Japanese Wikipedia,
a top-10 project, and I helped administrators there to fix the buggy code,
which appeared in the second most-popular gadget.

I did this dozens of times, and Krinkle probably does this even more than
me. Often admins from different projects help each other, and it is great
that we have this mutual help in the community, but aren't there better
ways to catch such errors?

I remember there were discussions about this, but I don't remember what was
the outcome.

--
Amir Elisha Aharoni · אָמִיר אֱלִישָׁע אַהֲרוֹנִי
http://aharoni.wordpress.com
‪“We're living in pieces,
I want to live in peace.” – T. Moore‬
_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: catching errors in local JavaScript

Jeremy Baron
In reply to this post by Amir E. Aharoni
On Jan 18, 2017 11:26, "Amir E. Aharoni" <[hidden email]>
wrote:

Remind me please, were there ever any efforts to get client-side JavaScript
errors monitored centrally?


I think you're looking for
https://phabricator.wikimedia.org/project/profile/976/ aka
https://phabricator.wikimedia.org/tag/sentry/

-Jeremy
_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: catching errors in local JavaScript

Eran Rosenthal
I wrote 2 years ago a phantom-js based script to catch all JS errors in all
wikis:
https://github.com/eranroz/wiki-js-error-log

See also:
https://phabricator.wikimedia.org/T71519




On Wed, Jan 18, 2017 at 6:37 PM, Jeremy Baron <[hidden email]> wrote:

> On Jan 18, 2017 11:26, "Amir E. Aharoni" <[hidden email]>
> wrote:
>
> Remind me please, were there ever any efforts to get client-side JavaScript
> errors monitored centrally?
>
>
> I think you're looking for
> https://phabricator.wikimedia.org/project/profile/976/ aka
> https://phabricator.wikimedia.org/tag/sentry/
>
> -Jeremy
> _______________________________________________
> Wikitech-l mailing list
> [hidden email]
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l
>
_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: catching errors in local JavaScript

Federico Leva (Nemo)
In reply to this post by Amir E. Aharoni
AFAIK https://www.mediawiki.org/wiki/Extension:Sentry is the way to go,
perhaps currently blocked on procurement
(https://phabricator.wikimedia.org/T93138 ).

https://phabricator.wikimedia.org/T106915 or
https://phabricator.wikimedia.org/T382 might be the main discussions on
the matter.

Nemo

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: catching errors in local JavaScript

Bartosz Dziewoński
In reply to this post by Amir E. Aharoni
UploadWizard has such a mechanism, recording all JavaScript exceptions
that happen on https://commons.wikimedia.org/wiki/Special:UploadWizard
(using some of the machinery originally designed for Sentry, some custom
glue code, and some EventLogging definitions).

Using EventLogging mostly works, but it has some strict limitations on
the size of data you can record there, so we can't save for example
error backtraces. That's still much better than nothing at all, though.

You'll also find that, unless a problem is affecting literally everyone
on every page, it's really difficult to separate problems in code you
can fix from problems in code you can't. Turns out that a large number
of people use very broken browser extensions, or user scripts, or
browser, or entire computers, that throw exceptions left and right
whenever the user looks at it wrong. Since browsers' security features
and ResourceLoader's mechanisms often hide the real source of the error,
you have to investigate everything by hand. And that's my experience
only looking at errors happening on one page, on one wiki. :)


--
Bartosz Dziewoński

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: catching errors in local JavaScript

Gergo Tisza
In reply to this post by Federico Leva (Nemo)
On Thu, Jan 19, 2017 at 1:35 AM, Federico Leva (Nemo) <[hidden email]>
wrote:

> AFAIK https://www.mediawiki.org/wiki/Extension:Sentry is the way to go,
> perhaps currently blocked on procurement (https://phabricator.wikimedia
> .org/T93138 ).
>

It's stalled due to lack of time, with a fair amount of puppet wrangling
still needed before it could go into production even as a limited
experiment.

Also, a lot of its value is conditional on source maps (T47514
<https://phabricator.wikimedia.org/T47514>) which AFAIK is also stalled due
to lack of time.

On Thu, Jan 19, 2017 at 10:58 AM, Bartosz Dziewoński <[hidden email]>
 wrote:

> Using EventLogging mostly works, but it has some strict limitations on the
> size of data you can record there, so we can't save for example error
> backtraces. That's still much better than nothing at all, though.


It also wouldn't scale to logging every error on every page, although if
you are interested in gadget errors, you could just restrict it to
logged-in users.

It would probably be possible to get more intelligent heuristics by moving
some of the logic from the Sentry extension to use the EventLogging
pipeline (load raven-js on errors, get the stack trace, send the top few
rows of it + a hash to EL), to deduplicate browser/language error message
differences and detect errors which originate in gadgets. Not sure how far
you could get without source maps though.
_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: catching errors in local JavaScript

Bartosz Dziewoński
In reply to this post by Bartosz Dziewoński
Oh, and also, a more general limitation: the error messages may be
localised, depending on the browser. I hope you speak Korean.

--
Bartosz Dziewoński

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: catching errors in local JavaScript

Amir E. Aharoni
That's OK—I mainly want to know that the error occurred at all.


--
Amir Elisha Aharoni · אָמִיר אֱלִישָׁע אַהֲרוֹנִי
http://aharoni.wordpress.com
‪“We're living in pieces,
I want to live in peace.” – T. Moore‬

2017-01-19 12:16 GMT-08:00 Bartosz Dziewoński <[hidden email]>:

> Oh, and also, a more general limitation: the error messages may be
> localised, depending on the browser. I hope you speak Korean.
>
>
> --
> Bartosz Dziewoński
>
> _______________________________________________
> Wikitech-l mailing list
> [hidden email]
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l
>
_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l