TelegramBots/Telegram.Bot.Examples

GetUpdates Conflict

win32nipuh opened this issue · 1 comments

I have created the test Telegram bot console app using sample from this repository, I have used the polling.

There is my main

public static async Task Main()
{
    ServicePointManager.Expect100Continue = true;
    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
    Bot = new TelegramBotClient(Configuration.BotToken);
    var me = await Bot.GetMeAsync();
    Console.Title = me.Username;

    var cts = new CancellationTokenSource();

    // StartReceiving does not block the caller thread. Receiving is done on the ThreadPool.
    Console.WriteLine($"Bot.Timeout= {Bot.Timeout}");

    //Bot.Timeout = TimeSpan.FromMilliseconds(30000);
    Bot.StartReceiving(
        new DefaultUpdateHandler(HandleUpdateAsync, HandleErrorAsync),
        cts.Token
    );

    Console.WriteLine($"Start listening for @{me.Username}");

    Console.ReadLine();

    // Send cancellation request to stop bot
    cts.Cancel();
}

I run it on Windows 10 - it works fine. But when I run it on the Windows 7 machine I receive the exception:

Bot.Timeout= 00:01:40 Start listening for @my123_bot HandleErrorAsync Telegram.Bot.Exceptions.ApiRequestException: Conflict: terminat ed by other getUpdates request; make sure that only one bot instance is running at Telegram.Bot.TelegramBotClient.d__541.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNot
ification(Task task) at
Telegram.Bot.TelegramBotClientPollingExtensions.d__3.MoveNex
t() HandleErrorAsync Telegram.Bot.Exceptions.ApiRequestException:
Conflict: terminat ed by other getUpdates request; make sure that only
one bot instance is running at
Telegram.Bot.TelegramBotClient.d__541.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNot ification(Task task) at Telegram.Bot.TelegramBotClientPollingExtensions.d__3.MoveNex t()

But there is one instance only at this machine.

What is the reason and how to fix it?

I’m closing this issue because it has been inactive for a few months. This probably means that it is not reproducible or it has been fixed in a newer version.

Please reopen if you still encounter this issue with the latest stable version and then please use the issue template.