-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AltAsync.OnScriptRpc throws weird IO exception when either client emits with parameters or server try to answer #820
Comments
@duydang2311 can u check it please with dev version 15.0.202-dev |
There are some issues with the new version, seems like I won't be able to quickly check this. I just updated the module and nuget. Now the same warning appears after resource is started and the server exits after segmentation fault. I don't load any resources at all. [19:55:25] alt:V Server 15.0-dev912 (dev)
[19:55:25] Starting Dev Server on [::]:7788
[19:55:25] Required server permissions:
[19:55:25] Optional server permissions:
[19:55:25] Starting HTTP server on [::]:7788
[17760:17760:20231130,195525.919295:ERROR file_io_posix.cc:144] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)
[17760:17760:20231130,195525.919380:ERROR file_io_posix.cc:144] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2)
[19:55:25] Main thread started (ThreadId: 17750)
[19:55:25] EntityStreamer thread started (ThreadId: 17785)
[19:55:25] SyncSend thread started (ThreadId: 17787)
[19:55:25] SyncSend thread started (ThreadId: 17788)
[1] 17750 segmentation fault (core dumped) ./altv-server Version:
|
already suggested a change. Better wait before its implemented. |
public class FactionWritable : IWritable
{
public string Id { get; set; }
public string Leader { get; set; }
public string Name { get; set; }
public string Acronym { get; set; }
public ushort Type { get; set; }
public string Color { get; set; }
public string Description { get; set; }
public void OnWrite(IMValueWriter writer)
{
try
{
writer.BeginObject();
writer.Name("Id");
writer.Value(Id);
writer.Name("Name");
writer.Value(Name);
writer.Name("Acronym");
writer.Value(Acronym);
writer.Name("Type");
writer.Value(Type);
writer.Name("Color");
writer.Value(Color);
writer.Name("Description");
writer.Value(Description);
writer.Name("Leader");
writer.Value(Leader);
writer.EndObject();
} catch (Exception e)
{
Console.WriteLine(e);
}
}
}
private async Task OnScriptRpc(IScriptRPCEvent @event, IPlayer target, string name, object[] args, ushort answerId)
{
/*var factionCollection = await _databaseService.Database
.GetCollection<Faction>("factions")
.FindAsync(faction => faction.Id == ObjectId.Parse("657adcabfe0bdd5e055d9f68"));
var faction = await factionCollection.FirstOrDefaultAsync();
if (faction is null)
return;
*/
FactionWritable factionWritable = new()
{
Id = "faction.Id.ToString()",
Name = "faction.Name",
Acronym = "faction.Acronym",
Type = 1,
Color = "faction.Color",
Description = "faction.Description",
Leader = "faction.Leader.ToString()"
};
@event.Answer(factionWritable);
Alt.LogInfo("Send faction writable");
} [16:35:09] Execution of AltV.Net.Async.Events.ScriptRpcAsyncDelegate threw an error: System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exce
ption.
at AltV.Net.Async.AsyncScriptRpcEvent.Answer(Object answer)
at Armonia.Server.Event.FactionEvent.OnScriptRpc(IScriptRPCEvent event, IPlayer target, String name, Object[] args, UInt16 answerId) in C:\Users\ruben\Desktop\armonia-roleplay\a
rmonia-gamemode\Armonia.Server\src\Event\FactionEvent.cs:line 69
at AltV.Net.Async.AsyncEventHandler`1.ExecuteEventAsync(TEvent subscription, Func`2 callback)
tested on alt:V Server 15.0-dev969 (dev) also, when awaiting my query (without mock) it doesn't crash but doesn't emit the answer as well |
pls try it with nuget 15.0.205-dev |
fixed with dev 15.0.207 |
also fixed with all 16.0.* versions |
Well, I just tried this out with 16.0.7-dev and same issue still unfortunately. AltAsync.OnScriptRpc += (e, player, name, args, answerId) =>
{
return Task.CompletedTask;
}; [17119:17119:20231226,144834.100949:ERROR file_io_posix.cc:144] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)
[17119:17119:20231226,144834.101032:ERROR file_io_posix.cc:144] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2) Specifications:
|
Consider below code:
e.Answer("OK");
The exception looks like this:
I have a workaround to replicate async event handler using
Alt.OnScriptRPC
instead, but may throw exception if incorrectly used.The text was updated successfully, but these errors were encountered: