Code Monkey home page Code Monkey logo

Comments (7)

paniksystem avatar paniksystem commented on August 31, 2024 1

Oh i thought it was precisely the case that was fixed by this :D anyway thank you

from libdatachannel.

paniksystem avatar paniksystem commented on August 31, 2024

Looks like this happens when recvfrom fails inside agent_run, making it exit the loop and destroy the agent

from libdatachannel.

paullouisageneau avatar paullouisageneau commented on August 31, 2024

Good catch, it seems that it's not even a race condition, I actually forgot the test in libjuice when the thread terminates to destroy the agent only if its destruction has been requested. For some reason the connectivity test doesn't crash.

from libdatachannel.

paniksystem avatar paniksystem commented on August 31, 2024

Maybe you also need to release the agent mutex?

from libdatachannel.

paniksystem avatar paniksystem commented on August 31, 2024

i ended up doing this to fix it:

if (len < 0) {
	JLOG_ERROR("recvfrom failed, errno=%d", sockerrno);
	agent->thread_started = false;
	pthread_mutex_unlock(&agent->mutex);
	agent_change_state(agent, JUICE_STATE_DISCONNECTED);
	return;
	//break;
}

from libdatachannel.

paullouisageneau avatar paullouisageneau commented on August 31, 2024

Maybe you also need to release the agent mutex?

Oh, yes indeed. Your solution works except in the edge case where destruction is requested, and at the same moment recvfrom fails.

from libdatachannel.

paullouisageneau avatar paullouisageneau commented on August 31, 2024

FYI, I took the opportunity to add a proper thread interruption mechanism to libjuice, which allows to join the thread on destruction: paullouisageneau/libjuice@dd3a537

from libdatachannel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.