Skip to content
This repository has been archived by the owner on Feb 8, 2019. It is now read-only.

Assitant module freezes after some use (Uncaught TypeError) #25

Closed
E3V3A opened this issue Mar 16, 2018 · 7 comments
Closed

Assitant module freezes after some use (Uncaught TypeError) #25

E3V3A opened this issue Mar 16, 2018 · 7 comments
Labels
bug Confirmed bug help wanted

Comments

@E3V3A
Copy link
Collaborator

E3V3A commented Mar 16, 2018

After having my assistant put to test, it suddenly froze while recording.

Uncaught TypeError: Cannot read property 'dismiss' of null
I'm not sure which alert.js this come from.

Here is a screenshot:

2018-03-16-115255_1057x735_scrot

This might be related to #12.

@E3V3A
Copy link
Collaborator Author

E3V3A commented Mar 25, 2018

This may be related to #9...

@E3V3A E3V3A added the bug Confirmed bug label Mar 25, 2018
@E3V3A
Copy link
Collaborator Author

E3V3A commented Mar 28, 2018

Not sure if related, but I found this in the error log in the updated version when frozen.

[ASSTNT] Conversation Error: { Error: Service unavailable.
    at ClientDuplexStream._emitStatusIfDone (/home/pi/MagicMirror/modules/MMM-Assistant/node_modules/google-assistant/node_modules/grpc/src/client.js:255:19)
    at ClientDuplexStream._receiveStatus (/home/pi/MagicMirror/modules/MMM-Assistant/node_modules/google-assistant/node_modules/grpc/src/client.js:233:8)
    at /home/pi/MagicMirror/modules/MMM-Assistant/node_modules/google-assistant/node_modules/grpc/src/client.js:757:12 code: 14, metadata: Metadata { _internal_repr: {} } }

The code generating the log message is:

        .on('error', (error) => {
          console.log('[ASSTNT] Conversation Error:', error);
          record.stop()
          this.sendSocketNotification('ERROR', 'CONVERSATION')
        })

@E3V3A
Copy link
Collaborator Author

E3V3A commented Mar 30, 2018

Another error that arrived today out-of-the-blue, while using Google.

Error: write after end
    at writeAfterEnd (/home/pi/MagicMirror/modules/MMM-Assistant/node_modules/readable-stream/lib/_stream_writable.js:288:12)
    at Speaker.Writable.write (/home/pi/MagicMirror/modules/MMM-Assistant/node_modules/readable-stream/lib/_stream_writable.js:332:20)
    at Conversation.conversation.on (/home/pi/MagicMirror/modules/MMM-Assistant/node_helper.js:259:21)
    at emitOne (events.js:96:13)
    at Conversation.emit (events.js:188:7)
    at ClientDuplexStream.Conversation.conversation.on (/home/pi/MagicMirror/modules/MMM-Assistant/node_modules/google-assistant/components/conversation.js:118:12)
    at emitOne (events.js:96:13)
    at ClientDuplexStream.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at ClientDuplexStream.Readable.push (_stream_readable.js:134:10)

I have no fcuking idea what this means!
Anyone else seen this?

If this has anything to do with this module, then line 259 is here:

      conversation
        .on('audio-data', (data) => {
          //record.stop()
          const now = new Date().getTime()
          if (mode == 'ASSISTANT') {
            this.sendSocketNotification('MODE', {mode:'ASSISTANT_SPEAKING'})
            speaker.write(data);             //   <<=== ERROR LINE =================== 
            spokenResponseLength += data.length;
            const audioTime = spokenResponseLength / (this.config.assistant.conversation.audio.sampleRateOut * 16 / 8) * 1000;
            clearTimeout(speakerTimer);
            speakerTimer = setTimeout(() => { speaker.end(); }, audioTime - Math.max(0, now - speakerOpenTime));
          } else {

@E3V3A
Copy link
Collaborator Author

E3V3A commented Mar 31, 2018

The original error is coming from Line 133 in alert.js of the default Alert module of MM:

	hide_alert: function(sender) {
		//Dismiss alert and remove from this.alerts
		this.alerts[sender.name].dismiss();  // <<========= LINE  113 !
		this.alerts[sender.name] = null;
		//Remove overlay
		var overlay = document.getElementById("overlay");
		overlay.parentNode.removeChild(overlay);
},

I have filed an issue here.

@E3V3A
Copy link
Collaborator Author

E3V3A commented Mar 31, 2018

note:

  • all modules are receiving and handling SHOW_ALERT and HIDE_ALERT...
  • /var/log/auth.log has some mysterious message:
    systemd-logind[351]: Removed session c30.

EDIT: systemd seem to com from cron...

EDIT2: This comment invalid.

@E3V3A
Copy link
Collaborator Author

E3V3A commented Apr 2, 2018

This was fixed in MM PR: MagicMirrorOrg/MagicMirror#1248

The other issues now seem unrelated to OP. (Open new issue for those if they re-occur.)

@E3V3A E3V3A closed this as completed Apr 2, 2018
@E3V3A
Copy link
Collaborator Author

E3V3A commented Apr 2, 2018

PS. To fix this while MM dev PR is being considered, fix yourself with:

    hide_alert: function(sender) {
        //Dismiss alert and remove from this.alerts
        if (this.alerts[sender.name]) {
            this.alerts[sender.name].dismiss();
            this.alerts[sender.name] = null;
            //Remove overlay
            var overlay = document.getElementById("overlay");
            overlay.parentNode.removeChild(overlay);
        }
    },

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Confirmed bug help wanted
Projects
None yet
Development

No branches or pull requests

1 participant