drzyeetvt41077335 2019-06-05 07:11
浏览 72

“高负载”时退出状态3221225477(当数十个程序实例正在运行时)

I call this compiled exe from another Go program - to synthesize audio on Windows. SpVoice() but not simpler SpeechSynthesizer API because of crackles in the audio. Everything works fine but when I have in parallel not a ten but a few dozens copies of this program (each one is called from a goroutine) sometimes I am getting 3221225477. My C# code:

using System;

using System.Runtime.Serialization;

using SpeechLib;

class Program {
    static SpVoice synth = new SpVoice();
    static SpMemoryStream wave = new SpMemoryStream();

    static void Main(string[] args) {
        synth.AudioOutputStream = wave;

        // https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ms720595(v%3Dvs.85)
        wave.Format.Type = SpeechAudioFormatType.SAFT44kHz16BitMono;

        using (var stdin = Console.OpenStandardInput()) {
            using (var stdout = Console.OpenStandardOutput()) {
                var m = (Message)new System
                    .Runtime
                    .Serialization
                    .Json
                    .DataContractJsonSerializer(typeof(Message)).ReadObject(stdin);

                // https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ms722610(v%3dvs.85)
                foreach(SpObjectToken voice in synth.GetVoices()) {

                    if (voice.GetDescription().Contains(m.Voice)) {
                        synth.Voice = voice;
                    }
                }

                synth.Speak(m.Text);

                var wavBytes = (byte[])wave.GetData();
                stdout.Write(wavBytes, 0, wavBytes.Length);
            }
        }

        wave = new SpMemoryStream();  // Withoit reinit will concatenate
        synth.AudioOutputStream = wave;

    }
}

[DataContract]
class Message {
    [DataMember]
    public string Voice { get; set; }

    [DataMember]
    public string Text { get; set; }
}

I found that 3221225477 mean STATUS_ACCESS_VIOLATION. I tried try/catch everything and write to logs but on such exit I found no records in Event Viewer. I run this on Windows Server 2019 on Google Cloud.

Update: I found that Wav returned from stdout even on this error.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 Stata 面板数据模型选择
    • ¥20 idea运行测试代码报错问题
    • ¥15 网络监控:网络故障告警通知
    • ¥15 django项目运行报编码错误
    • ¥15 请问这个是什么意思?
    • ¥15 STM32驱动继电器
    • ¥15 Windows server update services
    • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
    • ¥15 模糊pid与pid仿真结果几乎一样
    • ¥15 java的GUI的运用